Posts

Showing posts from February, 2010

c# - Class naming alternatives to the underscore? -

dashes - can't used in c# name classes. there character alternatives, other underscores? _ i'm looking character add readability longer class names. thanks! looking not use casing methods.. replace underscore... find horrible @ glance.. classaisthisfirstvariable classaisthissecondvariable classaisthisthirdsvariable just looking underscore replacement.. classaisthis_firstvariable classaisthis_secondvariable classaisthis_thirdvariable take @ this , this options. note underscore standard character purpose opinion, replacing lead less readability...

Javascript how to split string characters into variables -

i trying split string's characters variables this: <script> var string = "hello"; //after splitting: var stringat1 = "h"; var stringat2 = "e"; var stringat3 = "l"; var stringat4 = "l"; var stringat5 = "o"; </script> could give example of how can done? string.prototype.split() function can used requirement. the split() method splits string object array of strings separating string substrings. usage var string = "hello"; var arr = string.split(''); var stringat1 = arr[0]; alert(stringat1)

jquery insertafter() is not working in $(this) variable -

jquery insertafter() not working in $(this) variable. my coding here <select name="input_field[]" class="selectcase"> <option value="">select</option> <option value="input">text</option> <option value="option">option</option> </select> script $(this).change(function (){ $("<div><input type='text' name=''></div>").insertafter($(this)); }); i have many select tag , choose particular select tag. using change function, want add textbox after select tag. used insertafter() function. not working. dont use this id in first line, must replaced select : $('select').change(function (){ $("<div><input type='text' name=''></div>").insertafter($(this)); });

NameError and ValueError in Python -

why python shell throwing nameerror windows console valueerror? def printargs(*arg): list = ['1','2'] in arg: try: print(list[int(i)]) except valueerror: print('please enter integer value') except nameerror: print('name error') if __name__ == '__main__': printargs(*sys.argv[1:]) providing following arguments windows console gives output: here how call code in windows console: c:\>c:\python34\python c:\users\user\documents\pytest\test.py 0 1 please enter integer value providing following arguments python shell not display cusom error nameerror mentioned in code above, mentions following error: printargs(0,a) traceback (most recent call last): file "<pyshell#0>", line 1, in <module> printargs(0,a) nameerror: name 'a' not defined in code example you've provided define list i, iterate on collection called list never...

ruby on rails - How to rescue_from ActionDispatch::Cookie::CookieOverflow? -

first @ all, have read: cookie overflow in rails application? and not problem i'm facing. i'm working with: gem "rails", "~> 3.2.11" and ruby 1.9.3-p125 i'm trying process search, , when search tooooooo big error: actiondispatch::cookies::cookieoverflow i rescue_form error in applicationcontroller seems not working me: rescue_from actiondispatch::cookies::cookieoverflow :with => :render_404 where: def render_404 respond_to |r| r.html { render :template => "something/404", :status => 404} r.all { render :nothing => true, :status => 404 } end true end any going received. rescue_from actiondispatch::cookies::cookieoverflow :with => :render_404 you missing comma (,) in arguments , according docs with correc syntax rescue_from actiondispatch::cookies::cookieoverflow, with: :render_404 rescue_from receives series of exception classes or class names, ,...

sql - java select large table and export to file -

i have table 62,000,000 rows aprox, need select data these export .txt or .csv my query limit result 60,000 rows aprox. when run query in developer machine, eat memory , java.lang.outofmemoryerror in moment use hibernate dao, can change pure jdbc solution when recommend my pseoudo-code is list<map> list = mydao.getmydata(params param); //program crash here initfile(); for(map map : list){ util.append(map); //this transform row file } closefile(); suggesting me write file? note: use .setresulttransformer(transformers.alias_to_entity_map); map instead of entity lock table , perform subset selection , exports, appending results file. ensure unconditionally unlock when done. not nice, task perform completion on limited resource servers or clients.

php - How can I view a test ARB transaction in authorize.net? -

i set arb page sandbox authorize.net account , transaction going through, error_log has nothing in it, wanted view dummy info sent make sure it's logging transaction somehow if possible. i'm using sample data test subscription page , sending out. able view authorize.net sandbox account received data anywhere? i have tried in both live/test modes , subscriptions remain @ 0 both modes. if cannot test way, how can page that's sending request report me request/response successful? thanks you have login in authorize.net merchant account , set silent post url there , when ever transaction done return response in json format , need capture event in silent post url script , response need store in table field , later on can check it. for further assistance can check following url. http://www.johnconde.net/blog/tutorial-integrate-the-authorize-net-arb-api-with-php/

gulp stop/cancel running task -

how can cancel/stop current running task in gulp? my task: gulp.task('scripts', function() { return gulp.src('js/main.js') .pipe(browserify({ transform: [to5ify] })) .pipe(gulp.dest('./dist')); }); it runs in watch: gulp.task('watch', function() { gulp.watch('js/**/*.js', ['scripts']); }); if change js file, task runs, thats nice. if change file while task running, task not stop , restart. how can fix this? the task runs average of 20s , described case occurs frequently

excel - How to use Vlookup inside VBA with a variable worksheet name -

i need use vlookup inside vba worksheetname changes can referenced activeworkbook.worksheet(1) , activeworkbook.worksheet(2). used dim selection can refer ws1 , ws2 of course inside vlookup formula kind of script doesn't work. hope can rewrite vlookup formula lines. it regards last 5 lines activecell.formular1c1 lines need solution 'ws2'! help. dim ws1 worksheet dim ws2 worksheet set ws1 = activeworkbook.worksheets(1) set ws2 = activeworkbook.worksheets(2) ws1.select selection.autofilter range("g2").select activecell.formular1c1 = "web sales" range("h2").select activecell.formular1c1 = "web stock" range("i2").select activecell.formular1c1 = "total sales" range("j2").select activecell.formular1c1 = "total stock" range("f2:f71").select selection.copy activewindow.smallscroll down:=-102 range("g2:j71").select activewindow.smallscroll down:=-66 selection.pastespecial p...

Why do parameter values in Lua C functions show up at the bottom of the stack? -

take example simple c function lua: int luacfunc(lua_state *l) { printf("%g\n", lua_tonumber(l, 1) + lua_tonumber(l, 2)); } in case, parameters show index 1 , 2 . since positive number represent stack bottom-up, mean parameters located @ bottom of stack, not top. why case? wouldn't require shifting entire stack on every function call make room parameters? the lua stack specific function call. each c function call gets own "stack" (it's slice of bigger stack, that's hidden you). arguments both @ top , @ bottom, because they're thing on stack.

ruby on rails - Spec not logging in to edit profile -

i using rspec , capybara write tests editing devise user profile: require 'rails_helper' feature "edit profile" scenario "visiting site edit profile" given_i_am_logged_in and_i_visit_edit_registration_page when_i_edit_profile i_should_be_redirected_to_home_page end end def given_i_am_logged_in @user ||= factorygirl.create :user login_as @user end def and_i_visit_edit_registration_page visit edit_user_registration_url end def when_i_edit_profile fill_in_fields end def fill_in_fields fill_in "user[name]", with: @user.name fill_in "user[hospital]", with: @user.hospital fill_in "user[email]", with: @user.email fill_in "user[current_password]", with: @user.password click_button "update" end def i_should_be_redirected_to_home_page expect(page).to have_content("home page") expect(page).to have_link("sign out") end the error is failures: ...

generics - Java: Instantiating array object of type T using a factory -

i instantiate array of type t such: items = new t[maxque]; here code far, believe non-reflective approach: interface myfactory<t> { t[] newobject(); } public class queue< t extends comparable<t> > { private int front; private int rear; private t[] items; private int maxque; private static final int max_items = 1000; public queue(myfactory<t> factory) { maxque = max_items + 1; front = maxque - 1; rear = maxque - 1; items = factory.newobject(); items = new t[maxque]; } } the { items = factory.newobject(); } works , resolves compiler error not know how set size of array maxque using myfactory interface. how can declare array size of maxque? on side note, while know definition of reflection in java, can please put and/or concept of factories in layman terms? edit: found decent description of reflection here: what reflection , why useful? i still bit unclear on when reflection should avo...

java - Rebind an stateless ejb -

the stateless bean works fine when deployed app server, @stateless(name = "utilitiespersonclient") @loggable public class utilitiespersonclient { and output of log shows created correctly : java:global/my-app/utilitiespersonclient java:app/my-app/utilitiespersonclient java:module/utilitiespersonclient however in tests when try rebind bean mock, doesn't rebound , no error thrown : ejbcontainer = ejbcontainer.createejbcontainer(p); @override @before public void setup() throws exception { super.setup(); utilitiespersonclient mockservice = mock(utilitiespersonclient.class); when(mockservice.getmymap(anycollection())).thenreturn(mockedmap()); ejbcontainer .getcontext() .rebind("java:module/utilitiespersonclient", mockservice); } how rebind stateless bean using ejbcontainer ? the rebind doesn't alter existing instances. alters binding yet occur. so, overcome injected calling class, , altered call...

Java Swing: Why can't I drawImage() on an instance of JFrame? -

without going grave detail, i'm working toward creating desktop-like program in swing, icons drawn on top of background image. subclass jpanel or jcomponent , draw on that, wanted try new kicks, , tried drawing on instance of jframe, without making program subclass of it. i aware not accepted way of doing this, discovering image not drawn has exposed missing link (one of many, suppose) in understanding of swing , how paints components. what confuses me if program subclasses jframe , override paint() method (the accepted way, in other words), draw image jframe, not instance of jframe in non-subclassed program. hopefully code showing want help: public class imageloader { bufferedimage img = null; jframe window = null; public imageloader() { try { img = imageio.read(new file("src/strawberry.jpg")); }catch(ioexception e) { e.printstacktrace(); } window = new jframe("strawberry viewer"); window.setde...

php - In Laravel 5, how make sure a user is authed uniquely? -

i'm searching solution allow user logged in once @ same time. i'm new laravel , in case i'm using out of box (file session driver , default auth-handling custom views). my idea 'reset' auth user after logs in second time, automatically make other active sessions invalid. so primary question is: there way accomplish laravel magic or need invent feature myself? what following: in usertable, add 1 column: sessionid (varchar or text) now want here following: when user logs in, store id of session in sessionid field. everytime user loads page, or makes request, check if sessionid value in db same sessionid of user logged in. if isn't, kill session , make him login again. now, when user logs in, check usertable if sessionid value filled. if so, change new sessionid. result requests old sessionid invalid (because of check) , user can access webapp/website new session. thus makes sure user authed uniquely.

Segmentation fault in mex with armadillo on Ubuntu 14.04 and matlab 2014Ra -

i tried using mex files armadillo linear algebra library. @ first,i tried simple program follows: could me? %%%% matlab script %%%%%%% mex -larmadillo -lgfortran armamex_demo.cpp x = randn(5,5); y = randn(5,5); % run demo using x , y z = armamex_demo(x,y,3) %%%%%%%%%%%%% mex files %%%%%% #include "armamex.hpp" #include <armadillo> using namespace arma; void mexfunction(int nlhs, mxarray *plhs[], int nrhs, const mxarray *prhs[]) { // check number of input arguments. if (nrhs != 3) mexerrmsgtxt("incorrect number of input arguments."); // check type of input. if ( (mxgetclassid(prhs[0]) != mxdouble_class) || (mxgetclassid(prhs[1]) != mxdouble_class) ) mexerrmsgtxt("input must me of type double."); // check if input real. if ( (mxiscomplex(prhs[0])) || (mxiscomplex(prhs[1])) ) mexerrmsgtxt("input must real."); // create matrices x , y first , second argument. mat x = armagetpr(prhs[0]); mat y = ...

html5 - Simple carousel using vw and a bit of jquery -

i had trouble working bootstrp carousel decided make simple one. in case may someone, made zip file here i tested on chrome , ie11, sliding effect not on ie works anyway.

c# - Regular expression behaves differently in Find in Files and in Search current file -

i'm trying find strings in code, while excluding stuff assemblyinfo.cs files, comments , xml content. i've come regular expression works when use ctrl + f , when trying use "find in files" dialog ( ctrl + shift + f ), delivers arbitrary result, including empty lines , lines contain e.g. opening curly brace {. is bug in vs2013? unfortunately don't have other versions available test behavior. here regular expression , explanation: ^[^\[/<]*\".*\" ^: start of line [^\[/<]*: amount of characters not [, / or < \".*\": amount of characters enclosed 2 quotation marks when using regular search ( ctrl + f ), detects lines like "this test" someobject->dosomething("this test"); and intentionally not detect lines following: [assembly: assemblytitle("....")] /// <param name="test">test</param> however, when i'm using "find in files" dialog, same expres...

python - Django prefetch_related from foreignkey with manytomanyfield not working -

for example, in django 1.8: class a(models.model): x = models.booleanfield(default=true) class b(models.model): y = models.manytomanyfield(a) class c(models.model): z = models.foreignkey(a) in scenario, c.objects.all().prefetch_related('z__b_set') doesn't work. is there way prefetch information need c[0].z.b_set.all() work without query? you can use select_related follow first part of relationship ( c.z 's foreignkey ) in 1 batch: c.objects.all().select_related('z').prefetch_related('z__b_set') the prefetch_related part, however, done in @ least 2 queries, stated in docs: prefetch_related, on other hand, separate lookup each relationship, , ‘joining’ in python. allows prefetch many-to-many , many-to-one objects, cannot done using select_related, in addition foreign key , one-to-one relationships supported select_related. supports prefetching of genericrelation , genericforeignkey.

visio c# get RGB-Color from a layer -

i try current color of layer in visio document rgb. problem colors, not set "rgb(1,2,3)" in formula. there colors set, based on current scheme. there colors "255" (layer color not chosen) or "19" (the used color depends on active scheme, eg. dark-gray). i need way transform "19" rgb-scheme, depending on current scheme , variant. heiko visio has first 24 colors fixed. others come in form of rgb(r, g, b) formula. list of fixed colors can obtained form document.colors . in all, start following: using system.drawing; using system.text.regularexpressions; using visio = microsoft.office.interop.visio; static color getlayercolor(visio.layer layer) { var str = layer .cellsc[(short)visio.viscellindices.vislayercolor] .resultstru[""]; // case 1: fixed color int colornum; if (int.tryparse(str, out colornum)) { var visiocolor = layer.document.colors[colornum]; return color.f...

Full outer join is resulting in Cartesian product when counting records in Cognos -

am doing full outer join on 2 tables , b on column "id" in cognos report studio. both tables have multiple records id column. requirement have count number of records each table , show on graph. when count records, multiplying records , resulting in cartesian product. a.id ---- b.id 1 ------ 1 2 ------ 2 2 ------ 2 3 ------ 4 4 ------ 5 5 ------ 6 when count get: a.id ---- b.id ---- count(a.id)---- count(b.id) 1 ---- 1 ---- 1 ---- 1 2 ---- 2 ---- 4 ---- 4 (am expecting 2 these kind of records) 3 ---- null ---- 1 ---- null 4 ---- 4 ---- 1---- 1 5 ---- 5 ---- 1 ---- 1 null ---- 6 ---- null ---- 1 i need present total number of records table , table b in graph. since resulting in cross product, graph values not giving correct results.can 1 suggest how avoid cartesian product 2nd record? please suggest if possible ...

ios - how to adjust height for section table view -

Image
i want ask how adjust height section : but if click cell (detail) direct viewcontroller, , viewcontroller, view seen : if drag / scroll bottom, header section show , if release, bounce covered navigationitem any advice? thx before hope helps you: self.automaticallyadjustsscrollviewinsets = yes; self.tableview.separatorinset = uiedgeinsetszero;

Javascript language switch on same button -

i have part of code: js: function changetext() { document.getelementbyid('lang').innerhtml = 'default language'; } html: <p id='lang'> other language <input type='text' style="font-size: 12px;" onclick='changetext()' value='click me'/> </p> "click me" button works, , switches "default language" "some other language", disappears after initial click. able switch , forth languages on same button, able add button. ? the problem replace whole inner html, whole content of p tag including button. you want put content want replace in sub element, instance span: <p> <span id='lang'>some other language</span> <input type='text' style="font-size: 12px;" onclick='changetext()' value='click me'/> </p> you can safely replace content of span because have no other needed htm...

java - Adding iText 5.5.6 to Android project with gradle exception -

i trying add itextpdf library android project using android studio (gradle). add library compile 'com.itextpdf:itextpdf:5.5.6' instruction getting error: error:execution failed task ':app:dexdebug'. com.android.ide.common.process.processexception: org.gradle.process.internal.execexception: process 'command '/opt/jdk1.7.0_79/bin/java'' finished non-zero exit value 2 my build.gradle is: apply plugin: 'com.android.application' android { compilesdkversion 22 buildtoolsversion "21.1.2" defaultconfig { applicationid "josealopez.com.software" minsdkversion 14 targetsdkversion 22 versioncode 104 versionname "1.0.4" } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } } packagingoptions { exclude 'meta-inf/asl2.0' exclude 'meta-inf/license' exc...

ruby on rails - Rails_admin show child models fields in parents show page -

i have item model , have itemimage child model embedded inside of parent. when open single items page in rails_admin, shows of children this: itemimage #55b766556c656e12d0ac0000, itemimage #55b766556c656e12d0ad0000, , itemimage #55b766566c656e12d0ae0000 how make rails_admin show of children fields inside parents page? possible show them table? i'm using mongoid. i have made simple solution. have added def name method model: def name "<a href=\"#{self.image_url}\"><img src=\"#{self.image_url(:thumb)}\" /></a>" end it shows me images of embedded models inside parents page. know not solution have found.

rust - The nightly build of rustfmt does not run on another Windows PC -

i built latest master branch of rustfmt on x64 windows 8.1 pc using rust nightly 2015/07/18. cargo build --release rustfmt needs nightly version of rust. and copied rustfmt.exe x64 pc, can not run , showed dlls missing. they std-74fa456f.dll, log-74fa456f.dll, rustc-74fa456f.dll, , syntax-74fa456f.dll. rust stable 1.1.0 installed on second pc. you need copy dlls rust installed on first pc. example, c:\rust , , copy required dlls rustfmt.exe in c:\rust\bin second pc on same folder rustfmt.exe.

javascript - Is there any event to detect momentum scrolling using jQuery on iOS device after touch end? -

i toggle menu @ bottom during scroll event. i've created fixed menu show/hides based on position top. event fires during touch. there way event triggered when web page scrolling after finger lifted off device? scroll event works on android device. function togglemenu() { if ($('.menu').offset().top < $('.fixed-menu').offset().top + 32) { $('.fixed-menu').css('visibility', 'hidden'); } else { $('.fixed-menu').css('visibility', 'visible'); } } $(window).on("load resize scroll touchstart touchmove touchend", function (e) { togglemenu(); }); html, body { height: 100%; -webkit-overflow-scrolling: touch; overflow-y: scroll; } as you're listening touchstart , touchmove , touchend of course trigger on touch well. try make trigger on scroll , , add timeout see if scrolling has stopped or not. $(d...

php - Why my codeigniter code about transaction does not work? -

my code liked this: $this->db->trans_strict(false); //close strict mode $this->db->trans_begin(); $updatearr = array('name'=>'test', 'age'=>22); $this->db->where('user_id', $user_id); $this->db->limit(1); $this->db->update('user_table', $updatearr); $logarr = array('created'=>'2015-07-30', 'content'=>'test' ); $this->db->set($logarr)->insert('log_table'); if ($this->db->trans_status() === false) { $this->db->trans_rollback(); return false; } else { $this->db->trans_commit(); return true; } does codeigniter transactions support activerecord? when first query return false , why second query return true ? what doing wrong ? please me. i use mysql innodb

Mule Properties Window not showing -

Image
i have update mule anypoint studio, mule properties window not showing. showing message "select mule component edit properties" . have selected mule component not showing properties edit. found question of similar properties not found in below link: http://forum.mulesoft.org/mulesoft/topics/mule_properties_editor i have downloaded new anypoint studio problem remains same. please me out. can open error log , check in there ? window > show view > other > error log i guess there should exception or logged. a couple of questions might travelshoot issue: - anypoint studio installation directory path - varsion of java - version of windows, 64 bits ?

php - Does DB::raw affect when uploaded on server? -

currently using code fetch data on mysql , working on localhost when uploaded on our aws server stop sorting? $raw = "( 3959 * acos( cos( radians('$lat') ) * cos( radians( '$lat' ) ) * cos( radians( longitude ) - radians('$lon') ) + sin( radians('$lat') ) * sin( radians( latitude ) ) ) ) distance"; $stores = db::table('stores') ->select('storename', 'id', 'photo', 'address', db::raw($raw)) ->orderby('distance') ->where('domain', $domain->appenv) ->take(25) ->get(); is there being affected when uploaded on aws? note our db on different server rds you should set data binding variables passed query. ->setbindings([$lat,....]) ->get(); in query shold replace these variables ? , add these variables setbinding array in order use.

delphi - cxGrid will not scroll upwards -

i have encountered strange issue cxgrid. after executing query fetch records, records show in grid. simple query: 'select * mytable order name asc' however,if try , select first record in grid,the grid jumps random record in middle of grid. can not scroll first record in grid 1 grid jumps to. however, beyond record can scroll , down. can not scroll middle upwards nor can select record on there. seems grid stuck on middle record. if change datacontroller gridmode = true then can scroll without problem loose functionality of grid. not dataset issue when replace grid normal grid scrolling functional. so wondering if bug of sort or setting in grid turned on/off accident. ps. findpanel visible. in case helps, below code , dfm of minimalist cxgrid project works fine me , doesn't show behaviour describe. if works you, too, perhaps identify difference in project causing problem. code: type tform1 = class(tform) cds1: tclientdataset; ...

ios7 - ios: Application tried to present a nil modal view controller on target -

i developing application,the requirement open email composer on button click of uialertview. message in message body of email copied uitextview. using following code snipt: -(void)alertview:(uialertview *)alertview clickedbuttonatindex:(nsinteger)buttonindex{ if (buttonindex == 0) { // opening message composer } else { mfmailcomposeviewcontroller *picker = [[mfmailcomposeviewcontroller alloc] init]; picker.mailcomposedelegate = self; [picker setsubject:@"test mail"]; [picker setmessagebody:messagebody.text ishtml:yes]; [self presentviewcontroller:picker animated:yes completion:null]; } } // mail compose delegate - (void)mailcomposecontroller:(mfmailcomposeviewcontroller *)controller didfinishwithresult:(mfmailcomposeresult)result error:(nserror *)error { [self dismissviewcontrolleranimated:yes completion:null]; } but issue getting error saying application tried present nil modal view controller on target. how can open default ...

mysql - Rails query selecting last record with distinct column -

i need make query retrieve "last" records of distinct column. i have model, languages, has 3 columns: locale -> es | en | de version -> 1 | 2 | 3 data -> aaa | bbb | ccc there can duplicated records locale, not version. example: es | 1 | aaa es | 2 | aab es | 3 | aba en | 1 | bbb en | 2 | bab and in example, need retrieve result: es | 3 | aba en | 2 | bab there last 2 versions of language. i'm doing query right now: language.all.order('created_at desc').group(:locale) but i'm getting: es | 2 | aba en | 1 | bab any ideas? in advance! here raw mysql query give result set want: select lang1.* languages lang1 inner join ( select l.locale, max(l.version) maxversion languages l group l.locale ) lang2 on lang1.locale = lang2.locale , lang1.version = lang2.maxversion i not ruby person, as can offer. i'm hoping know how translate mysql query query language have in op.

c# - Why am I not getting results when performing an intersection? -

users class: public class user { public int id { get; set; } public string email { get; set; } } code: var usersl = new list<user>() { new user{id = 1,email = "abc@foo.com"}, new user{id = 2,email = "def@foo.com"} }; var usersr = new list<user>() { new user{id = 1,email = "abc@foo.com"}, new user{id = 2,email = "def@foo.com"} }; var both = (from l in usersl select l) .intersect(from users in usersr select users); foreach (var r in both) console.writeline(r.email); which returns 0 results. i know can accomplish similar using join , want use intersect because a) going work on db code , want use function (too long go why) , b) i'm plain curious why...

sql server - Speedup ExecuteReader in C# -

i'm using c# sqldatareader in many loops. unfortunately can't read whole table , store data in list. have create sqldatareader again , again. once sqldatareader created, fast. creation of sqldatareader via executereader takes time. is there possibility improve creation time of sqldatareader ? i'm using .net 4.5.1 , sql server 2008. string sql = "select current_timestamp"; var connection = connections.get(); sqlcommand sqlcommand = new sqlcommand(sql, connection); sqlcommand.commandtimeout = 0; var reader = sqlcommand.executereader(commandbehavior.default); thanks michael string constring = configurationmanager.connectionstrings["applicationservices"].tostring(); sqlconnection conn = new sqlconnection(constring); conn.open(); sqlcommand cmd = new sqlcommand("select top 50000 * users", conn); datatable dt = new datatable(); sqldataadapter da = new sqldataadapter(cmd); da.fill(dt); please use datatable , sqldataadap...

How to get exact number of line from where the method called in iOS? -

i want exact number of line method being called. i have single method called multiple line in command different different lines. so, need line being called in controller . i have used following code stack overflow , passing me wrong line number: nsstring *sourcestring = [[nsthread callstacksymbols] objectatindex:1]; // example: 1 uikit 0x00540c89 -[uiapplication _callinitializationdelegatesforurl:payload:suspended:] + 1163 nscharacterset *separatorset = [nscharacterset charactersetwithcharactersinstring:@" -[]+?.,"]; nsmutablearray *array = [nsmutablearray arraywitharray:[sourcestring componentsseparatedbycharactersinset:separatorset]]; [array removeobject:@""]; nslog(@"stack = %@", [array objectatindex:0]); nslog(@"framework = %@", [array objectatindex:1]); nslog(@"memory address = %@", [array objectatindex:2]); nslog(@"class caller = %@", [array obj...

javascript - What is the websockets server location for this code? -

i have socket.io client code has been tested work server. <script> // create new websocket var socket = io.connect('http://localhost:8000'); // on message received print data inside #container div socket.on('notification', function (data) { var userslist = "<dl>"; $.each(data.users,function(index,user){ userslist += "<dt>" + user.user_name + "</dt>\n" + "<dd>" + user.user_description + "\n" + "<figure> <img class='img-polaroid' width='50px' src='" + user.user_img + "' /></figure>" "</dd>"; }); userslist += "</dl>"; $('#container').html(userslist); $('time').html('last update:' + data.time); }); i tried use simple web socket client tester software. 1 us...

sql - Android SQLite not selecting date -

i have sqlite database in app stores date in format of yyyy-mm-dd hh:mm:ss i love query transaction happend on month of of year code not working don't know why. query shown below, please advice. select count(id_sale) total_transactions,sold_to, strftime('%m', sale_date) month, strftime('%y', sale_date) year, sale_date sales month=5 , year=2015 after research discovered reason had casting work. here answer below. down vote anyway. select count(id_sale) total_transactions,sold_to, cast(strftime('%m', sale_date) integer) month, cast(strftime('%y', sale_date) integer) year, sale_date sales month=5

python - How to set image url of a div as its background in Django template -

i have below code in template, dynamically set background url value come django view <div class="profpic" style="background:url('{{ media_url }}{{ objects.profpicpath }}');background-size:cover"> </div> this gives output source code in browser below <div class="profpic" style="background-image:url('/usersopr/documents/documents/20150718/bd55adcd-9360-4a05-b506-18373805b600_20150718_152906.jpg');background-size:cover"> </div> so, {{ media_url }} rendered value '/usersopr/' {{ objects.profpicpath }} value 'documents/documents/20150718/bd55adcd-9360-4a05-b506-18373805b600_20150718_152906.jpg' what else missing ? here settings.py media_root = '//192.xxx.xxx.xxx/d$/usersopr/' media_url = '/usersopr/' i searching extensively in internet on how set image url dynamically populated django view , rendered in django template, couldn't through - tried using {{ ...

Integrating AngularJS in a JSP application using Spring-MVC -

we have jsp application developed spring-mvc needs integrate angularjs in parts of user interaction. we running problem urls. jsp application construct correct url uses <c:url/> prepends url root path of given application. can of course source anglularjs in jsp. but, angularjs uses internally many relative urls end being not found because lack root path of web application. can done it? example of angularjs use of relative urls: var app = angular.module("app", ['ngdragdrop', "ngroute", "editor", "popup", "history", "state", "launch"]) .config(function($routeprovider) { $routeprovider.otherwise({ templateurl: "res/views/actioner-view.html" }); }); in jsp, before loading scripts, add following line: var context_path = '${pagecontext.request.contextpath}'; and everywhere define url in javascript code, use t...

android - ProgressDialog crash in onPreExecute() method -

the progressdialog crashing in onpreexecute() method. below code snippet: public class testcasesactivity extends activity { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_testcases); xmlhelp = new xmlhelper(); configparser confparser = new configparser(); confparser.execute(); } private class configparser extends asynctask<void, void, void> { private progressdialog dialog; @override protected void onpreexecute() { dialog = new progressdialog(testcasesactivity.this); dialog.setmessage("loading testcases configuration..."); dialog.show(); } @override protected void doinbackground(void... params) { xmlhelp.getnumberofnodes(); return null; } @override protected void o...

c# - How do i use text to speech? -

i'm using xamarin. , android project. created new class , added code: using system; using android.speech.tts; using system.collections.generic; namespace app1 { public class texttospeech_android : java.lang.object, itexttospeech, texttospeech.ioninitlistener { texttospeech speaker; string tospeak; public texttospeech_android() { } public void speak(string text) { var c = forms.context; tospeak = text; if (speaker == null) { speaker = new texttospeech(c, this); } else { var p = new dictionary<string, string>(); speaker.speak(tospeak, queuemode.flush, p); system.diagnostics.debug.writeline("spoke " + tospeak); } } #region ioninitlistener implementation public void oninit(operationresult status) { if (status.equals(ope...

How do I declare a variable of enum type in Kotlin? -

according documentation created enum class enum class bitcount public constructor(val value : int) { x32(32), x64(64) } then i'm trying declare variable in function val bitcount : bitcount = bitcount(32) but there compilation error how declare variable of bitcount type , initialize int ? error:(18, 29) kotlin: enum types cannot instantiated enum instances declared inside enum class declaration. if want create new bitcount add shown below: enum class bitcount public constructor(val value : int) { x16(16), x32(32), x64(64) } and use everywhere bitcount.x16 .

spring mvc - Aspectj advice not getting executed -

i trying code simple aspectj implementation advice not getting executed. the loggingaspect class getting initiated in console can see s.o.p of constructor this logging aspect getting printed when applicationcontext loaded , controlleraspect initialized. when run main method , output name: john age :12 what expecting s.o.p @before advice should printed first , getter methods @afterreturning s.o.p should printed. there no compilation error , program running advice not getting executed. according pointcut, advice should implemented on methods of customer class. i went through of similar problems posted here , not figure out issue implementation. can 1 figure mistake making , provide resolution ? here snippet servlet-context.xml <context:component-scan base-package="main.com.controller"/> <!-- enables spring mvc @controller programming model --> <annotation-driven></annotation-driven> <aop:aspectj-aut...

c# - Add text before selected text in another textbox -

i'm having issues trying 1 textbox change another. explanation: there 2 richtextboxes (rich1, rich2). rich1 , rich2 have string in there chosen user (their server name). there buttons on form change selected text in rich1 different colours using this: private void btndarkblue_click(object sender, eventargs e) { rich1.selectioncolor = color.darkblue; } what i'd happen when clicks colour button, selected text in rich1 same in rich2 want add text before selected text in rich2, example if selects "nh" out of "funhaus" rich2 equal "fu\colour=12\nhaus" so in end, rich1 display (with colouring): "funhaus". rich2 display (with no colouring): "fun\colour=12haus" user has decided change word "haus" darkblue. here's code i've tried: rich2.selectedrtf = rich1.selectedrtf; i assumed because both equal same text work, seems add rich1's selected text beginning of rich2 formatting. ...

Seperatiing vowels and consonents of Linked List in Java -

a linked list can represented following structure:- struct node { char data; struct node* next; }; struct node { char data; struct node* next; };class node { public char data; public node next; }class node { public char data; public node next; } you given function, struct node* rearrangevowelsandconsonants(struct node* head);struct node* rearrangevowelsandconsonants(struct node* head);static node rearrangevowelsandconsonants(node head);static node rearrangevowelsandconsonants(node head); the pointer 'head' points start of linked list. implement function rearrange , return same list vowels occupy first half of list , consonants occupy second half. note: do not create new list, modify existing list. relative ordering of vowels , consonants should not change among themselves. you may assume list of length , half nodes contain vowels , other half contain consonants. if list null, return null. example: input: -...