Posts

Showing posts from June, 2010

spring - Injecting property using @Value to abstract class -

i have abstract class in trying use @value annotation inject value property file public abstract class parent { @value ("${shared.val}") private string sharedval; public parent() { //perform common action using sharedval } } @component public class childa extends parent { param a1; @autowired public childa (param a1) { super(); this.a1 = a1; } } i getting nullpointerexception since sharedval not set. tried adding @component stereotype on abstract class , still same thing. can inject value abstract class way? if not how can accomplish this? i think you'll find sharedval is being set, you're trying use in constructor. constructor being called (must called) before spring injects value using @value annotation. instead of processing value in constructor, try @postcontruct method instead, eg: @postconstruct void init() { //perform common action using sharedval } (or altern...

c++ - How does a pointer to a pointer correspond to a 2D array? -

i know question asked before, don't understand in context: here's code i'm trying examine, i'll comment it. please let me know i'm wrong int **a; // declaring pointer pointer = new int*[n]; // assigning pointer newly-allocated // space (on heap) array // of [size n] of pointers integers (i = 0; < n; ++i) // looping 0 n-1 a[i] = new int[n]; // assigning each slot's pointer // new array of size n? (i = 0; < n; ++i) // loop through rows (j = 0; j < n; ++j) // loop through each column current row a[i][j] = 0; // assign value 0 please let me know i'm wrong. don't understand a = new int*[n]; i'm trying figure out using common sense i'm having troubles. thank you! your code , comments correct. clear confusion pointers: a 2d array array of arrays. in order allow array...

c++ - Why does google test ASSERT_FALSE not work in methods but EXPECT_FALSE does -

both assert_true , assert_false not compile in librarytest class error. error c2664: 'std::basic_string<_elem,_traits,_alloc>::basic_string(const std::basic_string<_elem,_traits,_alloc> &)' : cannot convert parameter 1 'void' 'const std::basic_string<_elem,_traits,_alloc> &' it works since in test_f use. expect_false compiles fine in both librarytest class , test_f methods. how can use assert in method used test_f ? class librarytest : public ::testing::test { public: string create_library(string libname) { string libpath = setup_library_file(libname); librarybrowser::reload_models(); assert_false(library_exists_at_path(libpath)); new_library(libname, libpath); assert_true(library_exists_at_path(libpath)); expect_false(library_exists_at_path(libpath)); return libpath; } }; test_f(librarytest, libraries_changed) { string libname = ...

cocos2d x - ActionwithAction and ActionwithDuration method giving error -

i have old code .i trying port new version of cocos2dx giving me errors in following lines. ccsequence * pulsesequence = ccsequence::actiononetwo(ccfadein::actionwithduration(1), ccfadeout::actionwithduration(1)); ccrepeatforever* repeataction = ccrepeatforever::actionwithaction(pulsesequence); in actiononetwo, actionwithduration, , actionwithaction method.it telling me not part of ccsequence. ccsequence * pulsesequence = ccsequence::createwithtwoactions(ccfadein::create(1), ccfadeout::create(1)); ccrepeatforever* repeataction = ccrepeatforever::create(pulsesequence); this should work.

display binary tree with php -

i have table this id(ai) user_id parent_user_id zone_id 1 8 0 0 2 8_l 8 l 3 8_r 8 r and on want display binary tree,a nd use recursive function.,but seems not given correct put code <div id='all' style='width: 250px;' align="center">8 <?php //childnode(1); function childnode($id) { global $wpdb; $prefix=$wpdb->prefix; $check_parent_node= $wpdb->get_results( $wpdb->prepare("select * ".$prefix."user_reference parent_user_id =".$id." limit 2" )); $user_count = $wpdb->get_var( "select * ".$prefix."user_reference parent_user_id =".$id." limit 2" ); //select * ".$prefix."user_reference parent_user_id =".$id." limit 2 //var_dump($user_count); if($user_count>0) { echo "<div>"; foreach($check_parent_node $chkpn) ...

java - Using constants across the application -

i have few constant values refer across application. creating class below snippet. public class styles { public static final string tablestyle = "tablegrid"; public static final string fontfamily = "calibri"; public static final string headerstyle = "heading2"; public static final string footerstyle = "heading3"; public static final string tableheaderstyle = "heading1"; public static final string tabledatafontfamily = "cambria"; public static final int tableheaderfontsize = 16; public static final int tabledatafontsize = 12; } i assigning values in , referring them styles.headerstyle . doubt is, way or there better approach achieve this? enum ? thanks in advance. it depends on nature of application, in cases not practice have collection of constants in way, difficult tell without knowing context of application. btw, are sure you'll never (or never) change things "fontfamily" ? of c...

Volley library for Android parse xml response? -

i using volley library , getting response in xml.i want know how can parse response using /volley library.thank you. stringrequest req = new stringrequest(request.method.get, url, new response.listener<string>() { @override public void onresponse(string response) { processdata(response); } }, new response.errorlistener() { @override public void onerrorresponse(volleyerror error) { // handle error response } } ); in processdata method parse response.use simple sax parser or dom parser parse response string.

php - retrieving from multiple tables is taking too long time -

hi retrieving multiple tables , displaying result taking long time. following database code : "select count(distinct kgbupdate.gsxno) sat kgbupdate right join contactcenter on kgbupdate.ackno=contactcenter.ackno left join customerfeed on contactcenter.callid = customerfeed.callid date(contactcenter.callclose) between '".$start."' , '".$end."' , kgbupdate.gsxno!='' , contactcenter.callstatus = 'close' , customerfeed.overall in ( 1, 2 ) , contactcenter.location='".$location[$i]."' " what way speed using index thanks in advance. try this: select count(distinct kgbupdate.gsxno) sat kgbupdate right join contactcenter on kgbupdate.ackno=contactcenter.ackno , contactcenter.callstatus = 'close' , contactcenter.location='".$location[$i]."' " left join customerfeed on contactcenter.callid = customerfeed.callid , customerfeed....

Top tabs, bottom tabs and action bar tabs in android -

i developing android application android version of existing iphone app. in iphone app, there 5 bottom tabs (as ios support these). every tab has more 1 activities. for example: tab 1: has activity 1 starts activity 2 , on in single tab (tab 1) , navigation too. i have read following still have doubts. http://developer.android.com/design/patterns/pure-android.html http://developer.android.com/design/patterns/actionbar.html http://developer.android.com/guide/topics/ui/actionbar.html my questions are: 1) best replacement of such kind of tabs in android. if use action bar tabs right approach? 2) if use action bar tabs, possible start different activities in single tab , action bar navigation too? 3) when should use action bar tabs, top tabs or bottom tabs in android (tab host still not deprecated in android) please guide me. confused tabs in android. 1) can use navigation tabs! (and you'll use fragmnets , not activity) 2) of course, navigation us...

c# - validation using error provider and stop further execution -

i want validate winform using error provider. when user click on button multiple validated methods executed txtfieldone_validated(this, e); txtfieldtwo_validated(this, e); , need solution stop execution further if of validators fails , display error using error provider. i thought use private variable bool _formvalid private btnvalidatefields_click(object sender, eventargs e) { txtfieldone_validated(this, e); txtfieldtwo_validated(this, e); if(_formvalid) {continue...} } private void txtfieldone_validated(object sender, eventargs e) { if(....) errorprovider1.seterror(txtfieldone, "some error message") _formvalid = true; else(....) errorprovider1.seterror(txtfieldone, "") formvalid = false; } but using approach if last checked field true populated _formvalid remains true , form pass. i not clear trying do. per comments, suggest this.there no need call different validation method different contro...

Operator Overloading in Delphi -

is possible (in delphi) overload operators in classes. i've read time ago possible records found information classes in code below: type tmyclass = class class operator implicit(a: integer): tmyclass; end; class operator tmyclass.implicit(a: integer): tmyclass; begin // ... end; it (modified) address: http://docs.embarcadero.com/products/rad_studio/delphiandcpp2009/helpupdate2/en/html/devcommon/operatoroverloads_xml.html but when try use (inside delphi xe) get: procedure, function, property, or var expected (e2123) i want create own simple class matrix manipulating , possibility of using overloading opearators inside class expected opportunity. regars, artik operator overloading classes available in versions of compiler. available .net , ios compilers. windows , mac is not supported. the ios compiler can support because manages lifetime of class instances using arc. if desktop compilers ever switch arc can expect support operator overload...

windows phone 8 - Wp8 maps bounding rectangle -

i'm trying create mapcontrol, , need split current boundingrectangle 25 pieces, , realized there no boundingrectangle in wp7 version. how solve problem than? avoid using nokia maps if possible. private locationrectangle getmapbounds() { geocoordinate topleft = mapcontrol.convertviewportpointtogeocoordinate(new point(0, 0)); geocoordinate bottomright = mapcontrol.convertviewportpointtogeocoordinate(new point(mapcontrol.actualwidth, mapcontrol.actualheight)); if (topleft != null && bottomright != null) { return locationrectangle.createboundingrectangle(new[] { topleft, bottomright }); } return null; }

C++ - Convert array of floats to std::string -

i have array of floats fixed length. want convert array binary string. i cannot use const char * because string contain null-bytes. how use memcpy in case? have tried reinterpret_cast<string *> , won't work because string also/only storing pointers begin , end of data (correct me if wrong). i'm constructing empty string: string s; s.resize(arr_size); but how copy array of floats string? basically, want dump memory region of fixed float array string. don't hard me, i'm still learning c++ like this: #include <algorithm> #include <string> float data[10]; // populate std::string s(sizeof data); char const * p = reinterpret_cast<char const *>(data); std::copy(p, p + sizeof data, &s[0]); note sizeof data same 10 * sizeof(float) , i.e. number of bytes in array. update: suggested james, can better , write in 1 go: char const * p = reinterpret_cast<char const *>(data); std::string s(p, p + sizeof data); /...

asp.net - How to redirect a page request to another url -

i use url routing in web application. have changed url routing rules , links on other sites broken after release web application. here old , new rule examples: old one: http://domain/urun/sungerbob-tamir-seti/6/0 new one: http://domain/sungerbob-tamir-seti/6/0 what should ?

python - Why do metaclass have a type? -

i've little bit test understand metaclass in python. class test(object): pass print test.__class__ print test.__class__.__class__ print test.__class__.__class__.__class__ all of result same type . each of address not same can't understand why metaclass has metaclass recursively. explain me please? actually, addresses same: >>> id(test.__class__) 6384576 >>> id(test.__class__.__class__) 6384576 >>> id(test.__class__.__class__.__class__) 6384576 everything object in python, , each object must have class (it should belong type). can access class/type reference __class__ attribute, e.g.: >>> (1).__class__ <type 'int'> everything includes classes itself, of class/type called type : >>> (1).__class__.__class__ <type 'type'> in same time type 'type'> object , should reference class/type. since kind of special object, __class__ attribute refers itself: >...

How to hide spinner dropdown android -

i want hide spinner prompt popup on outside click. if prompt popup open , user press home key activity minimize when user again open application prompt popup should disappear. there way achieve this. thank edit:-- prompt popup not customized. can't hide them in onpause or onresume methods. well little complicated thought. i adding step step details here. try follow it. able achieve in api level 10. and solution assumes supposed close prompt dialog programatically when user clicks on home button or if had move next activity without user interaction the first step create custom spinner extending spinner class. let's say, have created class called customspinner in package com.bts.sampleapp my customspinner class looks this, package com.bts.sampleapp; import android.content.context; import android.util.attributeset; import android.widget.spinner; public class customspinner extends spinner{ context context=null; public customspin...

ios - How to display overlay over AVCaptureVideoPreviewLayer -

Image
i need display image(frame) overlay on avcapturevideopreviewlayer. how can this? -(void) viewdidappear:(bool)animated { avcapturesession *session = [[avcapturesession alloc] init]; session.sessionpreset = avcapturesessionpresetphoto; [session commitconfiguration]; calayer *viewlayer = self.vimagepreview.layer; nslog(@"viewlayer = %@", viewlayer); avcapturevideopreviewlayer *capturevideopreviewlayer = [[avcapturevideopreviewlayer alloc] initwithsession:session]; capturevideopreviewlayer.frame = self.vimagepreview.bounds; [self.vimagepreview.layer addsublayer:capturevideopreviewlayer]; avcapturedevice *device = [avcapturedevice defaultdevicewithmediatype:avmediatypevideo]; nserror *error = nil; avcapturedeviceinput *input = [avcapturedeviceinput deviceinputwithdevice:device error:&error]; if (!input) { // handle error appropriately. nslog(@"error: trying open camera: %@", error); } ...

c# - Show or Hide issue in rectangle on different state in WPF Windows -

i have problem in show or hide rectangle on button click. on mouse click rectprojectmenu1.visibility = visibility.visible; again mouse click rectprojectmenu1.visibility = visibility.hidden; in normal monitor in starting stage rectangle display , hide on button click in 1024*700 resolution. when maximize show or hide on button click. but, in big size monitor rectangle display or hide on maximize state, not visible in normal state my project window resolution 1024*700 try check in different monitors debugging mode. if have resolution problem in this, can find debugging mode in big screen mode.

php - error when unserialize the serialize data -

serialize data a:8:{s:10:"first_name";s:6:"harish";s:9:"last_name";s:5:"verma"; s:5:"email";s:16:"harish@facebook.com";s:7:"address";s:6:"jaipur";s:4:"city";s:6:"jaipur";s:5:"state"; s:9:"rajasthan";s:12:"country_name";s:5:"india";s:7:"cell_no";s:10:"8787878787";} it return true when change email harish@gmail.com .... please , in advance. if notice in serialized data have section defining email address s:16:"harish@facebook.com"; thats says field string of 16 characters. the string in field not 16 characters 19 characters so guess manually fiddling data after has been serialize()'d if going manually mess serialized data have make add up. either stop manually editing , re serialize() data or remember change size parameter data match edits.

json - How to serialize OBJECT ARRAY in java? -

this question has answer here: how serialize json object in java 4 answers i have object array, how can serialize array? give c# code , have write in java. thanks. c#: byte[] data = json.serialize<object[]>(parameters); please note want serialize array has objects.. realize not exact answer: objectoutputstream out = new objectoutputstream(anyoutputstream); out.writeobject(objectarray); i have problem anyoutputstream, don't know should place on parameter.. if object array contains serializable objects can use java.io.objectoutputstream objectoutputstream out = new objectoutputstream(anyoutputstream); out.writeobject(objectarray); ...

php - DATE_FORMAT in where condition of Codeigniter Active Record -

i want codeigniter equivalent of sql below: select * `table_name` date_format('table_name', "%y-%m") < "yyyy-mm" i have tried null answer.here how did it $this->db->select_sum('column_name')->from('table_name')->where("date_format('column_name','%y-%m') <","yyyy-mm")->get(); thnx help? use without quotes column_name date_format(column_name,'%y-%m') $this->db->select_sum('column_name') ->from('table_name') ->where("date_format(column_name,'%y-%m') <","yyyy-mm") ->get();

validation - Validate empty select in controller? -

i have view has select list on shown below: <g:select name="field_time" from="${["00", "01", "02", "03", "04", "05", "06", "07", "08", "09"] + (10..23)}" value="${timehr}" noselection="['':'-time-']"/> now when user not select list , "noselection" value set expect param store "" data on forms submit. went on trying validate if data in select field empty on controller couldn’t on domain data never hits domain, had code below: if(params.field_time.size() == 0 || params.field_time == "" || params.field_time == null){ println("inside validate select function") } i check of params see being returned in object , data below: field_time:[, ] so when run code expecting print message screen doesn’t :s i presume checking wrong things in if statement , maybe th...

ember.js - Ember routing: Changing Ember.Location's pathname -

my ember app resides @ url [server]/app . ember's default hashlocation, urls turn out [server]/app#/[path] , not [server]/app/#/[path] . how can change ember.location.pathname /app /app/ make url work? how can change ember.location.pathname /app /app/ make url work? one way achieve change default location history app.router.reopen({ location: 'history' }); see here more info on that. hope helps.

mysql - Not possible using NHibernate? -

i new learner nhibernate. trying out samples mssql database. know query using mssql different mysql database. if need use sample mysql, need change other configuration settings? need know there not possible because of nhibernate? there multiple ways of configuring nhibernate. need set called: the dialect responsible converting iqueryable, icriteria or called hql (hibernate query language) sql of corresponding database. but if want have general, must pay attention id (in cases use locking). sql has called auto-identity, while oracle works sequencers. nhibernate has it's own ways of generating identity. i advise to: use latest nhibernate (not older 3.3.x.x) try out fluent nhibernate mapping eventually find example on nhibernate + fluent + unity/structure map (di framework) - find related ddd projects

asp.net mvc - pass data from controller to view -

i know there many ways it. want pass cerq text view. want see cerq in div. not want see div tags instead want browser interpret it. this function in controller public actionresult index() { viewdata["cerq"] = "<div>baha</div>"; return view(); } and view part @{ viewbag.title = "abc"; layout = "~/views/common/_layout.cshtml"; } <h2>menudene - @viewdata["cerq"] - </h2> what should do? in view wrote @html.raw(viewdata["cerq"]) and solves.

how to get the tag value of image in below lines of code in silverlight? -

i binding items follows: <scrollviewer> <itemscontrol x:name="userlist"> <itemscontrol.itemspanel> <itemspaneltemplate> <stackpanel orientation="horizontal" /> </itemspaneltemplate> </itemscontrol.itemspanel> <itemscontrol.itemtemplate> <datatemplate> <image source="{binding imageurl}" tag="{binding path=id}" width="164" height="150" margin="4" stretch="fill"></image> </datatemplate> </itemscontrol.itemtemplate> </itemscontrol> </scrollviewer> code.cs: list.add(new stackimages { id = "1", imageurl = new uri(this.baseuri, @"assets/acservice.png") }); list.add(new stackimages { id = "2", imageurl = new uri(this.baseuri, @"assets/brakes.png")...

asp.net - Keeping an ASP button from doing a Postback -

i've run strange problem asp.net project. upon clicking button, execute javascript function adds image img control. however, clicking button refreshes page, causing image disappear. i've tried setting usesubmitbehavior false, recall fixing similar problem i've had before. strangely enough, doesn't seem work. when inspect page, can see button's type has changed "submit" "button" onclick event has gained method "_dopostback", leaving me exact same problem. how can make sure _dopostback doesn't added onclick event? or there way prevent button doing postback? thanks in advance! <asp:button id="button1" runat="server" onclientclick="myjavascriptfunction(); return false;" /> the return false statement prevents postbacks. you can use anchor tag href set # .

Fix Highcharts dataLabels to the bottom -

i've been searching , can't find easy way fix highcharts datalabels bottom of graphic. i'm looking following, column chart: 80 - ┌──┐ ┌──┐ ┌──┐ 40 - | | ┌──┐ | | | | 0 -|_|__|_|__|_|_|__|_|__|_| 80 40 80 80 cat 1 cat 2 thank you help. you can iterate on each elemetn, , use translate function, allows "move" svg elements. var bottom = chart.plotheight - 20; $.each(chart.series[0].data,function(i,data){ data.datalabel.attr({ y: bottom }); }); take @ simple example: http://jsfiddle.net/wmlg6/39/

symfony - Doctrine MongoDB ODM do not change state of referenced object -

i'm using symfony2 doctrinemongodb bundle. made service receives informations in json format (objects). the object i'm sending got property referencing object in different collection in database. changing reference works. in case send field, "title" objectb - sets title new value in database. how can prevent this? i want set new reference, no manipulation on object ever. here code (shortened) class fun{ /** * @mongodb\id(strategy="auto") */ private $id; /** @mongodb\embedmany(targetdocument="jokeembedded", strategy="set") */ private $jokes = array(); } class jokeembedded { /** * @mongodb\referenceone(targetdocument="jokepattern", cascade={"persist"}) */ private $ref; /** * @mongodb\string */ private $title; } class jokepattern { /** * @mongodb\id(strategy="auto") */ private $id; /** * @mongodb\st...

perl - How to build up a hash data structure -

i having trouble figuring out how create several %th2 structures (see below) each of values of $th1{0} , $th1{1} , , on. i trying figure out how traverse keys in second hash %th2 . running error discussed in so, can't use string ("1") hash ref while "strict refs" in use also, when assign %th2 each key in %th1 , assuming copied %th1 anonymous hash, , not overriting values re-use %th2 . use strict; %th1 = (); %th2 = (); $idx = 0; $th2{"suffix"} = "a"; $th2{"status"} = 0; $th2{"consumption"} = 42; $th1{$idx} = %th2; $idx++; $th2{"suffix"} = "b"; $th2{"status"} = 0; $th2{"consumption"} = 105; $th1{$idx} = \%th2; $key1 (keys %th1) { print $key1."\n\n"; $key2 (keys %$key1) { print $key2->{"status"}; } #performing $key2 won't work. strict ref error. } change: $th1{$idx} = %th2; to: $th1{$idx} = \%th2;...

pickle - Python for the absolute beginner, Chapter 7 challenge 2 -

i've been going through exercises in book , i've hit bit of road block. challenge to: "improve trivia challenge game maintains high-scores list in file. program should record player's name , score. store high scores using pickled object." i've managed save scores list , append list dat file. however, when try view scores/read file seems show first score entered. took @ bat file , seems dumping list correctly, i'm wondering if i'm messing retrieval part? thanks reading here's code (before): def high_score(): """records player's score""" high_scores = [] #add score name = input("what name? ") player_score = int(input("what score? ")) entry = (name, player_score) high_scores.append(entry) high_scores.sort(reverse=true) high_scores = high_scores[:5] # keep top 5 # open new file store pickled list f = open("pickles1.dat", ...

testing - Accessing Javascript global variables from Selenium IDE -

i'm using latest selenium ide 2.2.0, and i'm having trouble trying access javascript global variable set in script. this variable acts success flag, i've put command: waitforcondition target: test value: 2000 but [error] test not defined i've tried looking @ access javascript variables selenium ide , replacing target: this.browserbot.getuserwindow().test but get [error] this.browserbot undefined i try different method of setting success flag throwing out alert, i'd know how access javascript variables. the docs mentioned storedvars, variables stored in selenium i'm @ wits' end. i looked around bit more , found following documentation for command: waitforeval note that, default, snippet run in context of "selenium" object itself, refer selenium object. use window refer window of application, e.g. window.document.getelementbyid('foo') if need use locator refer single element in application page, can us...

c++ - Conditional weak-linked symbol modification/redeclaration -

i have following weakly linked declaration: extern __attribute__((visibility ("default"))) type* const symbolname __attribute__((weak_import)); the problem is, symbol may or may not defined, depending on operating system. so, when use func(symbolname); , signal 11 crash because attempting dereference of null. ask if(&symbolname != null) { func(symbolname); } , require using symbol remember asking question, not optimal. i looking wizardly magic conditionally modify or redeclare symbol, if unavailable, have default value func work with. i understand ugly solution , not recommended. @ point, want know if there way it, no matter how ugly or low-level.

Wrapping methods up in a JavaScript object -

i have need this: <script src="apiwrapper.js"></script> <script> apiwrapper.init('api_key'); apiwrapper.dosomethingelse(); </script> essentially, have singleton style object in page can add methods , properties , have available anywhere within page. what's best way this? you use approach (which gives way of having private properties/functions): var apiwrapper = apiwrapper || (function () { /* private functions here */ var privatefunction = function () { } /* public functions here */ return { init: function (opts) {}, dosomethingelse: function () {} }; })();

Wordpress update user meta through woocommerce checkout process -

i'm creating points based system woocommerce in wordpress. based on usermeta added manually. (the idea being, people recycle products gain points, use points purchase products on seperate woocommerce shares user data). i have created checkout disables if not enough points, or adds amount user have left after purchasing products (possibly vunerable @ stage besides point). the problem i'm having updating user meta after purchase has been made. i.e every user has box called 'points' in user table admins can see - needs updated new formula of (current points - order total). heres code came not sure how implement or whether work.. planted in 'thankyou page' occurs after order has been 'placed' <?php $user_id = wp_get_current_user(); $pointsafterorder = $current_user->points - $woocommerce->cart->total; // return false if previous value same $new_value update_user_meta( $user_id, $current_user-...

java - How to replace the first word from each sentence (from input file) -

my problem have input file , must rewrite text, in output file without 4 words("a"),("the"),("a"),("the").i managed solve "a" , "the", not "a" , "the". plz me code? in advance. below problem,the input , code: problem: the english, words "a" , "the" can removed sentences without affecting meaning. opportunity compressing size of text files! write program inputs text file, line-by-line, , writes out new text file each line has useless words eliminated. first write simple version of program replaces substrings " " , " " in each line single space. remove many words, these words occur @ beginnings or ends of lines, , words start capitals. so, improve first program handles situations well. c:>java remover < verbose.txt > terse.txt note: there various replace() methods of class string simplify program. try write program without using them. input file...

jquery trigger or click not working? -

i struggling why can't trigger or click work? here js: $(document).ready(function () { function libertypop(){ var popup = jquery("#lightbox-30835684809970"); popup.click(); popup.trigger('click'); console.log("should work"); } libertypop(); }); this should triggering click on anchor: <a id="lightbox-30835684809970" style="cursor:pointer;color:blue;text-decoration:underline;"> liberty pop-up </a> in page, when click on link, pop appear, don't understand why jquery 'trigger' or 'click' not doing same? if want trigger native click event of anchor tag, use js event: var popup = jquery("#lightbox-30835684809970")[0]; //<< [0] retruns dom node popup.click(); but didn't have setted attribute href, nothing! if want trigger click handler attached using jquery, first set one. using code: $(document).r...

javascript - Three.js gui disappearing in background behind reloaded textures -

Image
so i'm guessing normal behavior, wanted ask make sure, , figure out how fix problem. in mapping app, have plane gets pre-loaded textures, , creates gui, 1 here: gui however in reality, program creates bunch of "layers" each own textures , places them in same spot. 1 layer corresponds 1 zoom level. when user zooms in amount, loops through current visible layer , makes meshes invisible, while making new ones next zoom level visible. the problem i'm having gui gets pushed background, behind textures. how keep gui in front? i cannot click on on gui. i've inspected html, , there's nothing indicative of causing this. changed z-index sure , had no effect. i've turned off textures, still having problem. strange part is, working gui example linked above has html looks mine. no clue be

javascript - How to get value of 'this' inputbox? -

i writing web application user clicks on div, holding input text box predefined text in it. when user clicks on div code printed in separate text box. trying write function grabs value of the clicked on div's text input. have working clicking on input box using $(this).val(); want click on div , gets value of (this)('input[type=text].provided_code').val(); is there way text input inside div? there 20 div's on page 20 inputs in each div, , each have same class name etc. yes can specify selector context: by default, selectors perform searches within dom starting @ document root. however, alternate context can given search using optional second parameter $() function documentation: http://api.jquery.com/jquery/#jquery1 so code this: $('input[type=text].provided_code', this).val() performance: http://jsperf.com/jquery-find-vs-context-sel/38

javascript - Get a complete a tag and not only the href attribute -

i going through string container tags contains. var links = container.find("a"); links.each(function(i, txt){ alert(txt); //shows http://some.com instead of <a href="http://some.com">some</a> }); any idea how solve one? thanks try - alert(this.outerhtml);

c# - Combo box causes app to crash when accessed using a touch interface, but works with a mouse -

i have combo box displays list of repositories on database, , event have dropdownopened event, during access database list of items display. everything works great using mouse open combo box , select item, when use touch screen (either on windows 8 or surface) there problems. the first time open combo box , select there no issues, after i've selected item, if try open list again, app crashes. here xaml combo box: <combobox x:name="repositorycombobox" grid.row="3" grid.column="1" selecteditem="{binding selectedrepository, mode=twoway}" itemssource="{binding repositorylist, mode=twoway}" style="{staticresource comboboxstyle}" isenabled="true" dropdownopened="reposdrop"/> and code drop down opened event: private async void reposdrop(object sender, object e) { viewmodel.repositorylist = null; try { await...

iphone - Expand section UITableview getting crash when reloadSections -

trying expand sections each section have 2 rows when expanded. giving crash. below code trying. -(nsinteger) numberofsectionsintableview:(uitableview *)tableview { return [self.marrques count]; } -(nsinteger) tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section { if(!helpon) return 1; else if(section == selectedcellindexpath) { return 2; } else{ return 1; } return 1; } -(uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"cellidentifier"; uitableviewcell *cell; cell = [self.mhelptable dequeuereusablecellwithidentifier:cellidentifier]; if (cell == nil) { cell = [[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier]; } else{ cell = [[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier]; } uiview* mybackgroundview = [[uiview alloc] i...

How to build reverse mapping URLs inside JSP using spring mvc router? -

i'm using spring-mvc-router have urls in centralized location. how can make reverse mapping of controllers inside jsp files? it's described in readme page of project, section integrating jsp : in jsp, declare taglib: <%@ taglib prefix="route" uri="/springmvc-router" %> then use reverse method generate urls: <a href="<route:reverse action="usercontroller.listall" />">list users</a> dynamic parameters can used: <a href="<route:reverse action="usercontroller.showuser" userid="42" />">show user 42</a>

java - EOFException in readUTF -

i getting below eofexception while using readutf() method, please let me know how overcome problem , please suggest how readutf() transfers socket information on other networks import java.io.*; import java.net.*; public class greetingserver { public static void main(string args[]) { string servername =args[0]; int port = integer.parseint(args[1]); try { system.out.println("server name "+ servername +"port"+port); socket client = new socket(servername,port); system.out.println("just connected to"+ client.getremotesocketaddress()); outputstream outs = client.getoutputstream(); dataoutputstream dout = new dataoutputstream(outs); dout.writeutf("hello from"+client.getremotesocketaddress()); inputstream in = client.getinputstream(); datainputstream din = new datainputstream(in); system.out.println("se...

mysql - Distinct with a group by -

i need write query filter data. in table have data grouped val1 multiple values of val2 witch have remove. my table this: | id | val1 | val2 | other | |------------------|------- | 1 | a1 | b1 | ... | 2 | a1 | b1 | ... | 3 | a1 | b2 | | 4 | a2 | b1 | | 5 | a3 | b1 | | 6 | a3 | b1 | | 7 | a3 | b2 | | 8 | a4 | b1 | | 9 | a4 | b3 | | 10 | a5 | b1 | and need this: | id | val1 | val2 | |------------------| | 1 | a1 | b1 | | 3 | a1 | b2 | | 4 | a2 | b1 | | 5 | a3 | b1 | | 7 | a3 | b2 | | 8 ... | 9 ... | 10 ... it's sort of select *,distinct(val2) table group val1.. you on right track using group by following should return results per question select min(id) id, val1, val2 yourtable group val1, val2 breakdown use aggregate function on column don't wish group on. in our example min aggregate function on id column. returns lowest id each group group by columns...

PHP: function glob() on Windows - patterns with multiple ranges -

i want list of images in directory ($path). want perform case-insensitive research file extension. code below works on linux, not on windows. foreach ( glob("$path/{*.[jj][pp][gg],*.[jj][pp][ee][gg],*.[gg][ii][ff],*.[pp][nn][gg],*.[bb][mm][pp],*.[tt][ii][ff][ff]}", glob_brace | glob_nocheck ) $file ) { echo $file; } i added glob_nocheck flag view computed patterns. here's response: fotogallery/dir/[gg] fotogallery/dir/[gg] fotogallery/dir/[ff] fotogallery/dir/[gg] fotogallery/dir/[pp] fotogallery/dir/[ff] it seems last range ([...]) of each comma-separated expression considered! why happens? thank you! :-) this may fix problem php manual comment sort of issue

iphone - UIWebView back button not getting enabled -

in application have uiwebview in need add browser functionality( user can goback,forward or reload page ). achieve have used code tutorial. in code have 1 change in viewdidload : i loading data local html file this: nsstring *htmlfile = [[nsbundle mainbundle] pathforresource:@"file name" oftype:@"html" indirectory:no]; nsdata *htmldata = [nsdata datawithcontentsoffile:htmlfile]; [self.webview loaddata:htmldata mimetype:@"text/html" textencodingname:@"utf-8" baseurl:[nsurl urlwithstring:@""]]; instead of: nsurl* url = [nsurl urlwithstring:@"http://iosdeveloperzone.com"]; nsurlrequest* request = [nsurlrequest requestwithurl:url]; [self.webview loadrequest:request]; after loading initial html file if making click on page button should enabled, instead of getting enabled after second url click , not able go original home page. please me this. thanks. i got answer. it's because load data webview w...

java - Injection of touch events using screen driver -

using android-event-injector library, wrote application inject touch event when event triggered. problem need inject touch @ absolute coordinates of given view , following location on screen: view v = /* find view*/; int [] coords = new int[2]; v.getlocationonscreen(coords); this gives me absolute coordinates on screen. problem touch injection doesn't work. i can inject correctly touches in screen driver, reason coordinates misunderstood , touches injected elsewhere. here examples (my screen 1024x600 landscape oriented): coords (0,0) -> injected in (0,0) coords (0,600) -> injected in (0,351) coords (1024,0) -> not injected (most x out of range) coords (1024,600) -> not injected (most x out of range) coords (640,480) -> not injected (most x out of range) coords (512,300) -> injected in (872,175) coords (100,100) -> injected in (170,58) based on sample values appears touchscreen (600, 1024), mapped (1024,600) display. to gen...

java - How to fix gap in GridBagLayout -

Image
i using gridbaglayout create jpanel, called 'preset' gets replicated several times in jframe. each preset have multiple rows (jpanels). goal 1 line (the first) show up, when edit button clicked show. right now, edit button works, there massive space between lines. want when lines collapsed, each preset directly above each other (no space). can see in following picture talking about. this how looks: this how want look: i need gridbag don't know what. have read several tutorials , have written thought should be, no luck. in advanced. package sscce; import java.awt.borderlayout; import java.awt.component; import java.awt.dimension; import java.awt.flowlayout; import java.awt.gridbagconstraints; import java.awt.gridbaglayout; import java.awt.gridlayout; import java.awt.toolkit; import java.awt.event.actionevent; import java.awt.event.actionlistener; import java.io.ioexception; import javax.swing.jbutton; import javax.swing.jcombobox; import javax.swing.jframe; im...

How to replace space/character with specified character after first numeric value in string using C#? -

i have string containing special characters & numeric values . eg: 3-3 3 3-3"3/4 3-3-3/4 3-3 3/4 3 3 3 3'3 3 output must be: 3f3 3 3f3"3/4 3f3-3/4 3f3 3/4 3f3 3 3f3 3 i have tried using : public static string replacefirst(string text, string search, string replace) { int pos = text.indexof(search); if (pos < 0) { return text; } return text.substring(0, pos) + replace + text.substring(pos + search.length); } using above code replaces first occurrence specified character works fine. eg: 3-3 3 output: 3f3 3 but 3 3-3 output: 3 3f3 according code correct. want replace space/character after first numeric 3f3-3 help appreciated! simple loops should work. for(int =0; < mylistofstrings.count; i++) { char[] chars = mylistofstrings[i].tochararray(); (int j = 0; j < chars.count(); j++) { if (char.isdigi...

c# - How to create multiple threads from an application and do not listen to their response? -

i trying following : i have server supposed many messages queue , process them. want create new thread every message , threads handle response queue, want server (core thread) listening messages , creating threads, not caring of happens them. how can achieve this? know can use thread class create thread application keeps listening thread until if finishes. can create async method , run happens when finishes? method supposed static if want async in current application not solution since use many non static variables method. any ideas appreciated. unless have specific reason, i'd recommend using tasks instead of threads. they'll run in background anyway, produce less cpu/memory overhead , (in opinion) easier handle in case of exception,... task t = task.run(() => processmessage(message)); maybe take @ this introduction

android - The ActionMode is being created twice with the ActionBarCompat r18 -

i found bug , posted in android's bug tracker: https://code.google.com/p/android/issues/detail?id=58321 i'm creating q&a-style question having same problem. if have same problem can't wait bug fixed, use patched version i've created solve bug: https://github.com/cybereagle/supportlibraryv7appcompatpatched

Update the preview text in a URL shared on Facebook -

so have client facebook page (currently unpublished). have shared hundreds of links website on wall on last few years. problem preview text on (if not all) of them out of date. i have looked on similar issues on here , have seen things suggest going https://developers.facebook.com/tools/debug , putting in url , clears facebook's cache. so tried on couple of links, , info debugger gets me correct, doesn't update links on facebook wall. question this: there way facebook refresh these already posted link descriptions, or have go through them manually reposting hundreds of links? i hope can help!

c# - DataGridView gives an error if a table field is binary type -

Image
for reasons, need write own sqlquery tool. works. but when select table contains binary type, gives me error i've shown below. i used datagridview. code below. private void button1_click(object sender, eventargs e) { string sql = txtsql.text.trim().tostring(); try { gridresult.datasource = getdataset(sql).tables[0]; } catch (sqlexception err) { messagebox.show("error : " + err.message + "-" + err.number); } } public dataset getdataset(string sql) { sqlconnection conn = new sqlconnection(connstr); sqldataadapter da = new sqldataadapter(); sqlcommand cmd = conn.createcommand(); cmd.commandtext = sql; da.selectcommand = cmd; dataset ds = new dataset(); conn.open(); da.fill(ds); conn.close(); return ds; } i wonder, there way prevent showing binary area or pre...

c# - Rx how to create a sequence from a pub/sub pattern -

i'm trying evaluate using rx create sequence pub/sub pattern (i.e. classic observer pattern next element published producer(s)). same .net events, except need generalize such having event not requirement, i'm not able take advantage of observable.fromevent. i've played around observable.create , observable.generate , find myself end having write code take care of pub/sub (i.e. have write producer/consumer code stash published item, consume calling iobserver.onnext() it), seems i'm not taking advantage of rx... am looking down correct path or fit rx? thanks your publisher exposes iobservables properties. , consumers subscribe them (or rx-fu want before subscribing). sometimes simple using subjects in publisher. , more complex because publisher observing other observable process. here dumb example: public class publisher { private readonly subject<foo> _topic1; /// <summary>observe foo values on topic</summary> p...

.net - Get Timezone Offset of Server in C# -

how can timezone offset of physical server running code? not date object or other object in memory. for example, following code output -4:00:00 : <%= timezone.currenttimezone.getutcoffset(new datetime()) %> when should -03:00:00 because of daylight savings new datetime() give january 1st 0001, rather current date/time. suspect want current utc offset... , that's why you're not seeing daylight saving offset in current code. i'd use timezoneinfo.local instead of timezone.currenttimezone - may not affect things, better approach. timezoneinfo should pretty replace timezone in code. can use getutcoffset : var offset = timezoneinfo.local.getutcoffset(datetime.utcnow); (using datetime.now should work well, involves magic behind scenes when there daylight saving transitions around now. datetime actually has four kinds rather advertised three , it's simpler avoid issue entirely using utcnow .) or of course use noda time library inst...

javascript - HTML automatic site login filling. value with no parameters -

the website im trying login has following username field <input type="text" id="inputemailhandle" name="inputemailhandle" value> im using zombie headless browser , nodejs, zombie cannot find input field named "inputemailhandle" cannot automatically log in, think because of value> there anyway can around it? or know way javascript , nodejs? ps website im trying log craigslist here's code var browser = require("zombie"); var assert = require("assert"); browser = new browser() browser.visit("https://accounts.craigslist.org", function () { browser. fill("inputemailhandle", "person@email.com"). fill("inputpassword", "password"). pressbutton("button", function() { console.log("logged innnnn!!!"); assert.ok(browser.success); }) }); the website running iso-8859-1 encoding, apparently not supported ...

html - Padding changes when the browser is zoomed in or out -

Image
i have thumbnail image , smaller image overlaps thumbnail image. padding changes smaller overlapping image zoom in , out , problem exist chrome browser. working fine ie , firefox. tried using percentage set padding values smaller image problem still exist. here images. this html <div class="car-item"> <div class=" car-image"> <img src="/~/media/images/thumb.ashx" alt="image 1" /> </div> <div class="car video"> <a href="#">video</a> </div> <div> position car video absolute position car item relative , car-image static you have issues @ times when using percentages. example of when use absolute positioning . i have no idea code looks here basic example of how accomplish have pi...

django - FeinCMS Initial Installation: Templates -

so trying feincms , running , have working on backend cannot page load: this how models.py setup: page.register_templates({ 'title': _('standard template'), 'path': 'base.html', 'regions': ( ('main', _('main content area')), ('sidebar', _('sidebar'), 'inherited'), ), }) page.create_content_type(richtextcontent) page.create_content_type(mediafilecontent, type_choices=( ('default', _('default')), ('lightbox', _('lightbox')), )) the error templatedoesnotexist @ /test/ zipfel/base.html django tried loading these templates, in order: using loader django.template.loaders.filesystem.loader: using loader django.template.loaders.app_directories.loader: /opt/local/library/frameworks/python.framework/versions/2.7/lib/python2.7/site-packages/django/contrib/auth/templates/zipfel/base.html (file not exist) /opt/loc...

css - How do I resize an image in IE 8 -

i have image 90px x 90px (it's jpg file) , can't figure out how make 60px 60px in internet explorer. looked @ few sites told me use css style: .img { -ms-interpolation-mode: bicubic; } but nothing happened. css i'm using works in fireforx , chrome: .img { horiz-align: center; width: 60px; height: 60px; margin: 10px; border: 1px rgb(218, 218, 218) solid; background: #c4c4c4 no-repeat 0 0; } the issue original code you're specifying img class i.e .img rather img here's 2 ways this. 1st no css: <img src="your-image.jpg" alt="" width="60" height="60" /> 2nd css: <img src="your-image.jpg" alt="" class="image-resize" /> ... img.image-resize { width: 60px; height: 60px; }

python - selenium with scrapy for dynamic page -

i'm trying scrape product information webpage, using scrapy. to-be-scraped webpage looks this: starts product_list page 10 products a click on "next" button loads next 10 products (url doesn't change between 2 pages) i use linkextractor follow each product link product page, , information need i tried replicate next-button-ajax-call can't working, i'm giving selenium try. can run selenium's webdriver in separate script, don't know how integrate scrapy. shall put selenium part in scrapy spider? my spider pretty standard, following: class productspider(crawlspider): name = "product_spider" allowed_domains = ['example.com'] start_urls = ['http://example.com/shanghai'] rules = [ rule(sgmllinkextractor(restrict_xpaths='//div[@id="productlist"]//dl[@class="t2"]//dt'), callback='parse_product'), ] def parse_product(self, response): self....

Velocity: Dereferencing a variable with a concatinated name -

i'm new velocity , couldn't find addressed problem, apologize if it's trivial. have following 200 variables. #set( $a1 = "apple", $b1 = "red", $a2 = "banana", $b2 = "yellow" .... .... $a100 = "plum", $b100 = "purple) i want output fruit followed color. there way concatenate "a" , "b" each of numbers in range(1,100) , dereference variable? like #foreach( $i in [1..100]) #set( $fruit = "a{$i}") #set( $color = "b{$i}") fruit $fruit color $color. #end i've tried many things, can ever manage output $a1 $b1 strings rather refer to. thanks! #set ($d = '$') #set ($h = '#') #foreach ($i in [1..100]) #evaluate("${h}set(${d}fruit = ${d}a${i})") #evaluate("${h}set(${d}color = ${d}b${i})") fruit ${fruit} color ${color}. #end

vba - MS Access runtime error 2115 -

in ms access, have 2 unbound combo-boxes: statebox , dvpcbox . statebox list of u.s. states , dvpcbox contains employee names query based on value of statebox. i'm trying set value of dvpcbox equal first item in list. since list of employees based on value of statebox, need value of dvpcbox update every time statebox changes. tried following: private sub statebox_afterupdate() me.dvpcbox.requery if (me.dvpcbox.listcount = 1) me.dvpcbox.setfocus me.dvpcbox.listindex = 0 //<-error here end if end sub but got runtime error 2115 - macro or function set beforeupdate or validationrule property field preventing microsoft office access saving data in field. the strangest thing me i'm not using beforeupdate event or validationrule (as far i'm aware.) itemdata(0) first combo box value. set combo equal that. private sub statebox_afterupdate() me.dvpcbox.requery if (me.dvpcbox.listcount >= 1) me.dvpcbox.setf...

javascript - Angular extending ui.bootstrap.progressbar to support some text on the progressbar -

i'm using ui.bootstrap.progressbar (code here: https://github.com/angular-ui/bootstrap/blob/master/src/progressbar/progressbar.js ) , i'm trying extend support custom html (or text) on progess bar. looks in vanilla bootstrap: <div class="progress"> <div class="bar" style="width: 60%;">this thing @ 60%</div> </div> http://plnkr.co/edit/wurplka0y6ck7hyt3gl1?p=preview i'm new @ directives, tried: in progressbarcontroller added label variable var label = angular.isdefined($attrs.label) ? $scope.$eval($attrs.label) : ''; also modified object controller returns include label. added bar.label in directive's template so: <div class="progress"> <progressbar ng-repeat="bar in bars" width="bar.to" old="bar.from" animate="bar.animate" type="bar.type"> </progressbar> ...

Android: client-server, user authentication -

i have never built such android application communicate sever. want want send username , password server, match them on server , when username , password matches next screen should shown. next screen should have 1 text view saying "welcome username". i want guys tell me step step guide - what should write in android app? what should write on server side? how , write server code? which language should use server side? how save several usernames-passwords on server? i don't have real server. run entire code on localhost. update: this wrote in android app. don't know how correct. public void clicked(view v) { system.out.println("button clicked"); edittext username = (edittext) findviewbyid(r.id.edituser); edittext password = (edittext) findviewbyid(r.id.editpass); editable user = username.gettext(); editable pass = password.gettext(); httpclient httpclient = new defaulthttpclient(); httppost httppost = new ht...