Posts

Showing posts from July, 2010

ios - I had 1 table view and three labels in it -

here problem had table view consists of 3 three labels in (test1, test2, test3) comes webservice. want load 3 labels in single table view. here code below : for (nsdictionary *entry in entries) { projectnames = [entries valueforkey:@"nm_project"]; tasknames = [entries valueforkey:@"task_name"]; subtasknames = [entries valueforkey:@"subtask_name"]; } nslog(@"project : %@", projectnames); nslog(@"tasknames : %@", tasknames); nslog(@"subtask : %@", subtasknames); - (nsinteger)numberofsectionsintableview:(uitableview *)tableview { #warning potentially incomplete method implementation. // return number of sections. return 1; } -(nsinteger) tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section { return [projectnames count]; } -(uitableviewcell*) tableview:(uitab

ios - GKLeaderboardViewController has no 'Done' button and oriented incorrectly, but GKAchievementViewController shows fine -

when showing achievements dialog using gkachievementviewcontroller, works expected. however, when showing leaderboard dialog using gkleaderboardviewcontroller, grey screen , no done button. furthermore, appears in wrong orientation on iphone. here code: this.leaderboardcontroller.timescope = gkleaderboardtimescope.alltime; this.leaderboardcontroller.category = "myleaderboardid"; this.leaderboardcontroller.modalpresentationstyle = uimodalpresentationstyle.formsheet; this.leaderboardcontroller.didfinish += (senderleaderboard, eleaderboard) => { this.leaderboardcontroller.dismissviewcontroller(true, null); }; viewcontroller.presentviewcontroller(this.leaderboardcontroller, false, null); i using same view controller use showing achievements dialog game center. i cannot dismiss leaderboard dialog because not have 'done' button. okay, problem was initializing view controller in constructor

android - How to close the 'Activity Home' when i was in 'Activity Details'? -

i got 3 activity namely 'acitvity login', 'activity home' , 'activity details' i go 'acitvity login' 'activity home' , mean time close 'acitvity login' 'activity home' go 'activity details' dont close 'activity home' since may have go 'activity home' in 'activity details' have button logout , on click of button have go 'acitvity login' now, question how close 'activity home' when in 'activity details'? thanks, nandakishore p in activity details : public static activitya instance = null; public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); instance = this; } @override public void finish() { super.finish(); instance = null; } then in acitvity login: public void oncreate(bundle savedinstancestate) { if(activitya.instance != null) { try { activitya.instance.finish(); }

How can I use CSS animations in SASS? -

i'm trying add simple css animation bootstrap links in rails, i'm having trouble. here's what's breaking: $link-color-hover: rgba(85, 85, 85, .3); :hover, :focus, :active { -webkit-transition-delay: 0s; -webkit-transition-duration: 0.5s; -webkit-transition-property: all; -webkit-transition-timing-function: ease; color: darken(#777, 50%); } any here? possible? try this: @mixin hovertransition { $link-color-hover: rgba(85, 85, 85, .3); color:$link-color-hover; -webkit-transition-delay: 0s; -webkit-transition-duration: 0.5s; -webkit-transition-property: all; -webkit-transition-timing-function: ease; &:hover, &:focus, &:active { color: darken(#777, 50%); } } .transition-link { @include hovertransition; } html <a href="#" class="transition-link">test me</a> you dont need define new mixin, clean things up. transition

java - What is an equivalent of LoggerRepository in log4j2 -

i want migrate log4j 1.x log4j2 read article: http://logging.apache.org/log4j/2.x/manual/migration.html in our application using loggerrepository: logger.getrootlogger().getloggerrepository().getcurrentloggers(); what equivalent of piece of code in log4j2. because in article said can't access method don't mention how should replace it if understand need correctly, can go via logmanager loggercontext 's configuration , retrieve logger s that: loggercontext ctx = logmanager.getcontext(); configuration cfg = ctx.getconfiguration(); map<string, loggerconfig> loggers = cfg.getloggers();

c# - Add checkbox in dropdownlist and this dropdownlist add radgridview -

i'm using telerik controls on project. want add dropdownlist column in radgridview , select multiple values. m using c# language. windows forms application. from http://www.telerik.com/help/winforms/gridview-columns-gridviewcheckboxcolumn.html gridviewcheckboxcolumn checkboxcolumn = new gridviewcheckboxcolumn(); checkboxcolumn.datatype = typeof(int); checkboxcolumn.name = "discontinuedcolumn"; checkboxcolumn.fieldname = "discontinued"; checkboxcolumn.headertext = "discontinued?"; radgridview1.mastertemplate.columns.add(checkboxcolumn); i think u mean right? next time try google answers first, way faster waiting answer here!

Integral Image or Summed Area Table of 2D matrix using CUDA C -

i trying compute summed area table 2d matrix number of rows , columns not equal . have run slight problem code seems function okay rows , columns equal, fails compute last row of final output when rows , columns not equal. problem can't figure out why happening. basic algorithm integral image/summed area table: basically, in integral sum every pixel or index element computes sum of matrix elements above , behind it. instance 3x2 input array following elements: [5, 2| |5, 2| |5, 2] the integral sum in output array as: [5, 7| |10, 14| |15, 21] basically following trying in cuda c: for(int matrixelement_y_index=0; matrixelement_y_index<=total_rows-1; matrixelement_y_index++) { //matrixelement_x_index , matrixelement_y_index represent (x,y) indices of each matrix element for(int matrixelement_x_index=0; matrixelement_x_index<=total_columns-1; matrixelement_x_index++) { int temp=0; for(int r=0;r<=(matrixelement_y_ind

android : image upload using multipartentity -

i'm trying upload image on php server using multipartentity, have used httpmime 4.3 jar import multipartentity, have added jar app, can't import class. public void postpicture(string path, file file) throws parseexception, ioexception { httpclient httpclient = new defaulthttpclient(); httpclient.getparams().setparameter( coreprotocolpnames.protocol_version, httpversion.http_1_1); httppost httppost = new httppost(path); multipartentity mpentity = new multipartentity(); filebody cbfile = new filebody(file, "image/png"); cbfile.getmediatype(); mpentity.addpart("userfile", cbfile); httppost.setentity(mpentity); httpresponse response = httpclient.execute(httppost); } can me. in advance.

matlab - how to find local maxima in image -

the question feature detection concept. i'm stuck after finding corner of image , want know how finding feature point within computed corners. suppose have grayscale image have data this a = [ 1 1 1 1 1 1 1 1; 1 3 3 3 1 1 4 1; 1 3 5 3 1 4 4 4; 1 3 3 3 1 4 4 4; 1 1 1 1 1 4 6 4; 1 1 1 1 1 4 4 4] if use b = imregionalmax(a); the result this b = [ 0 0 0 0 0 0 0 0; 0 1 1 1 0 0 1 0; 0 1 1 1 0 1 1 1; 0 1 1 1 0 1 1 1; 0 0 0 0 0 1 1 1; 0 0 0 0 0 1 1 1] the question how pick highest peak inside max local region (in sample how did chose 5 3 , 6 4)? my idea using b detect each region , use imregionalmax() again i'm not @ coding , need advice or other ideas. there couple of other easy ways implement 2d peak finder: ordfilt2 or imdilate . ordfilt2 the direct method use ordfilt2 , sorts values in local neighborhoods , picks n-th value. ( the mathworks example demonstrates how implemented max filt

c# - Showing record(s) from DB in a datagridview -

again, have access db connected form using c#. code works ( seems ) shows first record of db, nothing more in gridview. string connetionstring; oledbconnection connection; oledbdataadapter oledbadapter; dataset ds = new dataset(); string sql; connetionstring = @"provider=microsoft.jet.oledb.4.0;data source=z:\tempesta\area progetto\area_progetto_data_magazine\data_magazine\data_magazine\db\datamg.mdb;"; connection = new oledbconnection(connetionstring); sql = "select * prodotti"; try { connection.open(); oledbadapter = new oledbdataadapter(sql, connection); oledbadapter.fill(ds); datagridview1.datasource = ds.tables[0]; } catch (exception ex) { messagebox.show(ex.tostring()); } whats wrong?

sas macro in proc sql -

i have problem simple can't figured out. i have columns name1 c1 c2 c3 c4 .... c8 have sum names these columns , make new data. here code wrote didnt work. could please me? proc sql; create table work.data1 select t1.name1, %let k=8 %macro test; %do i=0 %to &k; %sysfunc(sum(c&i)) c&i; %end; %mend test; %test; work.data t1 group t1.name1, quit; data data; input name1 $ c1 c2 c3; datalines4; 1 2 3 1 2 3 b 1 2 3 b 1 2 3 ;;;; run; %macro test(k=); proc sql; create table work.data1 select t1.name1 %do i=1 %to &k.; , sum(c&i.) c&i. %end; work.data t1 group t1.name1; quit; %mend test; %test(k=3);

google api - access_type: 'online' and approval_prompt: 'force' together, request offline access the second time -

i try authorize application both params: https://accounts.google.com/o/oauth2/auth?scope=https://www.google.com/m8/feeds &response_type=code &access_type=online &approval_prompt=force &redirect_uri=..... ... first time requests access "manage contacts", ok. when try authorize second time, asks user allow "have offline access" permission, not ok. cleaning cookies doesn't help. neither revoking access in account settings. looks google bug. actually, need force user select account on authorize, not force ask offline access. i tried prompt=select_account instead, not working @ all. seem prompt=select_account works. required several accounts logged on same computer.

Is 'transition' an invalid resource directory name on Android? -

i make apidemos project android sample project. unfortunately, project complains invalid resource directory name transition /apidemos/res line 1 android aapt problem . my eclipse version: juno service release 2 , jdk 7. adt plugin v22.6.0. what's wrong it? yes, transition resources valid of api 19. to rid of error, make build sdk api level 19 or higher. to that, in eclipse/adt, either open project properties, go android , select project build target api 19, or edit project.properties @ project root , edit target e.g. android-19 of course, have have sdk 19 installed sdk manager , have up-to-date build tools installed.

coldfusion - How to ensure a cfobject variable is local to a function? -

assuming following code in regular .cfm file, not cfc: <cffunction name="myfunction"> <cfobject type="java" action="create" class="path.to.my.java.class" name="myjavavariable"> </cffunction> what going scope of created object? i'm getting feeling it's not limited function scope. if so, how make local? following work? <cfset var myjavavariable = ""> <cfobject ... name="myjavavariable"> edit: forgot under coldfusion mx 7, prevent useful solutions found on web working. i did find workaround 1 creates fake local scope ( <cfset var local = structnew()> ). work such tags since can put return variable local.somevar . i'd question why you're using <cfobject> @ all, rather more obvious simple assignment: var myjavavariable = createobject("java", "path.to.my.java.class"); isn't more natural code anyho

java - Multiple file upload with Spring 3 -

i need load unknown number of files @ once. found example, , works known amount of files: markup: <form method="post" enctype="multipart/form-data"> <input name="files[0]" type="file" /> <input name="files[1]" type="file" /> <input type="submit" value="send"/> </form> code: @requestmapping(method = requestmethod.post) public string savephoto(@modelattribute("album") album album, bindingresult result, sessionstatus status, multipartfileuploadbean file) { list<multipartfile> images = file.getfiles(); (multipartfile photo : images) { ... } return "redirect:/albums/"+album.getid(); } multipartfileuploadbean: public class multipartfileuploadbean { private list<multipartfile> files; public void setfiles(list<multipartfile> files) { this.files = files;} public list<multipartfile

ios - Spinning an image around like a coin -

Image
i have 1 image. want spin coin spin on surface. tried rotation transform not spin that. how achieve such animation? code: - (void)viewdidload { [super viewdidload]; [self.view setuserinteractionenabled:yes]; lbl_facebook.font=[uifont fontwithname:gzfont size:12.0f]; txtpassword.font=[uifont fontwithname:gzfont size:15.0f]; txtusername.font=[uifont fontwithname:gzfont size:15.0f]; catransition* transition = [catransition animation]; transition.startprogress = 0; transition.endprogress = 1.0; transition.type = @"flip"; transition.subtype = @"fromright"; transition.duration = 0.3; transition.repeatcount = 2; [_image.layer addanimation:transition forkey:@"transition"]; } nd: #import "loginviewcontroller.h" #import "registrationviewcontroller.h" #import "forgetpasswordviewcontroller.h" #import "forgetpasswordcontroller.h" #import "searchserviceproviderviewcontroller.h" #import <quartzcore/q

formatting date in android -

i'm trying display date have new format, i'm using simpledateformat this. android code string date = "2013-08-11 20:38 edt"; simpledateformat sf = new simpledateformat("dd mmmm yyyy hh:mm a"); try { newdate = sf.format(new simpledateformat("yyyy-mm-dd kk:mm z").parse(date)); } catch (parseexception e) { e.printstacktrace(); } it displays : 11 august 2013 08:38 pm however if run same code in java (as normal java console application) java string date = "2013-08-11 20:38 edt"; simpledateformat sf = new simpledateformat("dd mmmm yyyy hh:mm a"); string ldate = sf.format(new simpledateformat("yyyy-mm-dd kk:mm z").parse(date)); system.out.println(ldate); it displays : 12 august 2013 06:08 am this format need display. p.s. : got warning in android saying to local formatting use getdateinstance(), getdatetimeinstance(), or gettimeinstance(), or use new simpledateformat(string template, loca

r - Use of Makefile in RStudio -

why rstudio not display structure of makefile , specific targets , in rstudio's build tab? expect display them , allow 1 build specific targets. feature lacking in rstudio , rstudio server or it's there , need know enable it? submitted feature request rstudio team: https://support.rstudio.com/hc/communities/public/questions/200956606-feature-request-implement-makefiles-targets-processing .

install db2 database dump exported from linux to windows -

i have db dump system linux. have establish db on db2 server on windows. how can this? you cannot restore between platforms because have different endian. way recreate linux database windows via export - import/load, example: on linux * db2look * db2move export after, on windows * db2 -tf db2lookfile.sql * db2move import there many questions problem in stackoverflow on in other forums. please check them for more information, please check: http://pic.dhe.ibm.com/infocenter/db2luw/v10r5/topic/com.ibm.db2.luw.admin.ha.doc/doc/c0005960.html

Search and Replace with RegEx components in Atom editor -

i want search , replace this `https://example.com/`{.uri} to [https://example.com/](https://example.com/) with vim s/ (http.*) {.uri}/[\1](\1)/g doesn't work atom.io . how can solve this? if cmd-f , open search pane, there ".*" button @ right side. click , it's regex mode. i find (http.*)\{\.uri\} and replace [$1]($1)

unicode - Output difference after reading files saved in different encoding option in python -

i have unicode string list file, saved in encode option utf-8. have input file, saved in normal ansi. read directory path ansi file , os.walk() , try match if file present in list (saved utf-8). not matching if present. later normal checking single string "40m_Ãz­µ´ú¸ÕÀÉ" , save particular string (from notepad) in 3 different files encoding option ansi, unicode , utf-8. write python script print: print repr(string) print string and output like: ansi encoding '40m_\xc3z\xad\xb5\xb4\xfa\xb8\xd5\xc0\xc9' 40m_Ãz­µ´ú¸ÕÀÉ unicode encoding '\x004\x000\x00m\x00_\x00\xc3\x00z\x00\xad\x00\xb5\x00\xb4\x00\xfa\x00\xb8\x00\xd5\x00\xc0\x00\xc9\x00' 4 0 m _ à z ­µ ´ ú ¸ Õ À É utf-8 encoding '40m_\xc3\x83z\xc2\xad\xc2\xb5\xc2\xb4\xc3\xba\xc2\xb8\xc3\x95\xc3\x80\xc3\x89' 40m_Ãz­µ´ú¸ÕÀÉ i can't understand how compare same string coming differently encoded file. please help. ps: have typical unicode characters like: 唐朝小栗子第集.mp3 dif

java - Android context choice -

i don't understand context should use in (mapplicationcontext or context parameter onrecieve method). please, give me explanation context parameter should use , why (i read memory leaks, documentation methods) final pendingintent pendingintent = pendingintent.getactivity(**mapplicationcontext**, <smth>); notification.builder notificationbuilder = new notification.builder( **mapplicationcontext**).<smth>; notificationmanager notificationmanager = (notificationmanager) **mapplicationcontext**.getsystemservice(context.notification_service); // constructor public downloadertask(mainactivity parentactivity) { super(); mparentactivity = parentactivity; mapplicationcontext = parentactivity.getapplicationcontext(); } mapplicationcontext.sendorderedbroadcast(new intent( mainactivity.data_refreshed_action), null, new broadcastreceiver() { final string failmsg = &q

c# - Alert on button click -

i have 4 textboxes , need check null values. if of textbox value has null values on button click need show alert 'please enter values'. this code disable if textbox value empty. aspx: <tr style="height: 40px;"> <td> <asp:textbox id="txt1" runat="server"> </asp:textbox> </td> <td> <asp:textbox id="txt2" runat="server"> </asp:textbox> </td> <td> <asp:textbox id="txt3" runat="server"> </asp:textbox> </td> </tr> <tr> <td> <asp:button id="button1" runat="server" text="add" cssclass="button" width="50px" onclick="button1_click" /></td> </tr> cs: protected void button1_click(object sender, eventargs e) { if

Processing: scale and transform -

in processing application want translate shape , scale it. coordinate, scale, , translate-values saved in objects. in each cycle use same translate-value per object , bigger scale-value. the problem 'scale' somehow cumulated 'translate'- scale not happen in middle of object... how can setup objects scaling happens @ center? (int = 1; < formen.size(); i++) { form f = formen.get(i); pushmatrix(); f.sx = f.sx * 2; f.sy = f.sy * 2; scale(f.sx, f.sy); translate(f.tx, f.ty); nostroke(); createshape(); beginshape(); vertex(f.ax, f.ay); beziervertex(f.ax + f.kabx, f.ay, f.bx, f.by - f.kaby, f.bx, f.by); beziervertex(f.bx, f.by + f.kbcy, f.cx + f.kbcx, f.cy, f.cx, f.cy); beziervertex(f.cx - f.kcdx, f.cy, f.dx, f.dy + f.kcdy, f.dx, f.dy); beziervertex(f.dx, f.dy - f.kday, f.ax - f.kdax, f.ay, f.ax, f.ay); endshape(); popmatrix();

javascript - Prevent Click Event from document Level to child elements -

i create hybrid app using sencha frame work have setting screen, when setting screen visible in screen want prevent touch event user other components except specific views. saw of post saying event stopprogation() , preventdefault() event further not clear it. i tried add click event document release setting list view when user tap on screen if user tap on other component in screen trigger button action also, how prevent this. also don't want prevent action of touch when user click on setting list or specific component in view. note: not able use jquery in project because using jquery side sencha may cause performance issue. code: ext.define('myapp.view.controlpanel.controlpanel', { extend: 'ext.container', alias: "widget.controlpanel", requires: [ 'ext.segmentedbutton' ], config: { layout: { pack:'stretch' }, docked:'bottom' }, doc

function - JavaScript can not find Vaadin component id..? -

my code follow , javascript doesn't find component...maybe javascript load firstly may other.. can tell me what's wrong? thanks.. tab mytab = new tab(); mytab.setid("componentid"); javascript.getcurrent().execute("$(document).ready(function(){ "+ "$('#componentid').click(function(){ "+ "alert('clicked..');"+ "});"+ "});"); i found solution, should add query library url application html document header.. http://geekofficedog.blogspot.com.tr/2013/10/add-jquery-to-vaadin-7-application.html thanks..

python - Django (pre1.7) management command to run the customsql for an app -

django (pre 1.7 , pre-the new migration functionality), has management command sqlcustom display custom sql run app. prints terminal. there single django management command run migrations? i'm using django pre1.7 project uses south migrations, , have custom sql (for sql views), , want have database stuff done via migrations. custom sql loaded syncdb on vanilla django, when use south, overrides syncdb , doesn't run custom sql. i'd create south migration app simple , calls management command load custom sql. (you can call django management commands inside python ). don't want duplicate sql inside migration. you can pipe output of sqlcustom dbshell . this: django-admin.py sqlcustom myapp > django-admin.py dbshell

Django: Model Get Related Object -

i asked similar question earlier today: have following, table / class: class userfriend(model.model): user = models.foreignkey(user, related_name='friend_users' ) friend = models.foreignkey(user, related_name='friend_friends') active = models.booleanfield() where user built-in auth_user class, want friends, not userfriends object user specific user. i'm looking following sql: select u.* auth_user u, user_friend uf u.user_id = 5 , u.id = uf.friend_id , active=1 --- user_id = user being queried.. if user 1 want friends for: user.friend_users.filter(active=true).values_list('friend', flat=true)

perl - How to connect to an HTTPS server using JIRA::Client::Automated -

how can connect https server using perl jira::client::automated module? provide https url: use strict; use warnings use jira::client::automated; $user = 'foo'; $pass = 'bar'; $url = 'https://xxx.yyy'; $jira = jira::client::automated->new($url, $user, $pass); consider reading documentation , or @ least stating problems had when tried.

html - Selectable, scrollable output textarea -

Image
how create text area scrollable, has fixed height , allows marking text? html, jsf , pf4.0 elements possible, linebreaks of original text must respected. if use <p:inputtextarea> , set disabled="true", when mark text cannot release cursor. continue marking whereever cursor goes. also, disabled seems block me using scrollbar. it supposed similar activated scrollbar (doesn't matter if text greyed out): i don't know of way p:inputtextarea , i've used html element when i've needed that, rendered instead of disabled textarea: <ui:fragment rendered="#{lorem.disabled}"> <div style="max-width:150px;max-height:150px;overflow-y:auto;overflow-x:auto;white-space:pre;"> #{lorem.ipsum} </div> </ui:fragment> <p:inputtextarea value="#{lorem.ipsum}" rendered="#{!lorem.disabled}"/>

sharedpreferences - Usage of Shared Preferences in android library projects -

usage of shared preferences in android library projects allowed?i trying work on rating bar not sure whether can use shared preferences write that. if have context , supplied app using library, can use sharedpreferences . however, need bit careful ensure not accidentally try using same keys app might use. might consider using unique sharedpreferences file, rather getdefaultsharedpreferences() .

android - Scanner layout Zxing -

anybody knows how can customize scanner layout in zxing library? want modify width of scanner, try in capture.xml can´t. knows or there manual? thank you i explained how in post: https://medium.com/@marta/bar-code-scanner-in-android-with-custom-layout-zxing-2ab92d9d744c in short: add required aar dependencies in gradle ( https://github.com/embarkmobile/zxing-android-minimal#adding-aar-dependency-with-gradle ) provide custom layout capture activity. see sample/src/main/res/layout/custom_capture_layout.xml examples. set scanner in java code: intentintegrator integrator = new intentintegrator(this); integrator.setcapturelayout(r.layout.custom_layout); integrator.initiatescan(); for cancel/back button, use ids @id/zxing_back_button zxing-android-minimal.

asp.net - Json Structure Issue -

a third party api returning json in following format { "group1": { "colour": "blue", "name": "dave" }, "group2": { "colour": "red", "name": "karen" }, "group3": { "colour": "green", "name": "ryan" } } i'm finding outer 'groupx' identifier problematic when attempting deserialize json using json.net. does know best parse json in format? { "employees": [ { "first-name":"john" , "last-name":"doe" }, { "first-name":"anna" , "last-name":"smith" }, { "first-name":"peter" , "last-name":"jones" } ] }

How to use 2 MySQL SELECT Statements in one PHP query -

please me figure out how put following 2 statements 1 query. appreciated. $sql1 = 'select count(id) total_cat_votes votes category_id="1"'; $sql2 = 'select count(nominee_id') total_nom_votes votes category_id="1" , nominee_id="16"'; my idea here have table called votes , want number of total votes specific category under category_id different total votes of each nominee under nominee_id . hope clear enough. thanks help! use sum() second count condition ,using sum condition result in boolean 0 or 1,also using aggregate functions without grouping them result in single row select count(id) total_cat_votes, sum(nominee_id='16') total_nom_votes votes category_id='1'

ruby on rails - Update Cart's Quantity if same Product added -

i new ror. building e-commerce site. in shopping cart if try add products added if product not added before. want if user add same product quantity should incremented. here add_to_cart method in carts_controller.rb in advance. def add_to_cart @cart = cart.find_by_product_id_and_user_id( params[:product_id], current_user.id) if @cart.nil? @cart = cart.create(:user_id => current_user.id, :product_id => params[:product_id], :quantity => '1') else @cart.update(:quantity +=> '1') end redirect_to view_cart_path end your schema seems strange: why carts have product id? suggests cart "belongs_to" product, wrong. i'd have expected each user have single cart, , cart have list of products via join table. this: class user has_one :cart end #user_id class cart belongs_to :user has_many :cart_products has_many :products, :through => :cart_products end #cart_id, product_id, :quantity class cartproduct

jquery - file input javascript click generated not from a real mouse click chrome -

i'm having trouble in chrome opening popup file upload of file input type. as can see here: http://jsfiddle.net/cavax/k99gg/3/ , clicking on elements can trigger click on file input, example hovering element wont trigger click on input. $('#test').on('click', function(){ $('#upload').trigger('click'); }); $('#test').on('mouseenter', function(){ $('#upload').trigger('click'); }); in real life i'm having trouble because in web app i'm loading throw ajax content witch has inside input file. @ end of load popup file must open, there no way works on chrome (workign on ff). the problem guess action not generated mouse click (hover, timeout etc) chrome wont trigger fileupload. i've tryed this: http://jsfiddle.net/cavax/k99gg/7/ , click on element, wait trigger click nothing, because there "settimeout" in middle of click , trigger :( $('#test').on('click', function(){

html - <ul> is wider than list items -

Image
i have horizontal list 4 list items. want achieve simple task of having <ul> no wider cumulative width of <li>s right <ul> wider. in firefox's code inspector looks like: here html: <div id="content-container"> <div id="tabs"> <ul> <li>publications</li><li>urls</li><li>global folders</li><li>private folders</li> </ul> </div> </div> css: #content-container { width: 65%; float: right; background-color: red; } #tabs { width: 100%; text-align: left; margin: 10px 0 0 10px; } #tabs ul { width: 100%; list-style: none; text-align: left; } #tabs ul li { display: inline; background-color: #3e93cf; font-size: 24px; font-weight: bold; padding: 7px 10px 7px 10px; font-family: "segoe ui",verdana,helvetica,sans-serif; color: #fff; border-left: 1px solid #

select - file like io data structure in python that does not use files at all -

i looking file io data structure in python not use files @ all. memory file. tried cstringio , quite looking limitation not usable via select . sound, there data structure fulfills both requirements in way? think select nice , comfortable way check fds updates. although creating files on file system, spooledtemporaryfiles solved issue.

javascript - Add parameters to HTTP POST request in Node.JS -

i've known way send simple http request using node.js following: var http = require('http'); var options = { host: 'example.com', port: 80, path: '/foo.html' }; http.get(options, function(resp){ resp.on('data', function(chunk){ //do chunk }); }).on("error", function(e){ console.log("got error: " + e.message); }); i want know how embed parameters in body of post request , how capture them receiver module. would mind using request library . sending post request becomes simple as var options = { url: 'https://someurl.com', 'method': 'post', 'body': {"key":"val"} }; request(options,function(error,response,body){ //do want callback functon }); the request library has shortcut post in request.post method in pass url make post request along data send url. edit based on comment to "capture" post request best if used kind of f

javascript - Measure browser perfomance in JS -

we have pretty loaded web application updates lots of data (stock quotes) on web page via websockets without latency. brings problems perfomance clients have slow computers. we can change framerate of application , put aggregation , latency (similar angular does) first have detect if user needs (has troubles perfomance). is possible detect troubles prefomance in browser via js? may there global properties in chrome can current perfomance statistics? check window.performance (navtiming) javascript api, new html5 api. see availability @ http://caniuse.com/#feat=nav-timing

java - Name object by string variable -

the idea current year system running in, name study record after year , therefore refer current year. basically string variable , use name of object. have seen similar not accurate want , lack explanation looking for. date = new date();c // current date string currentyearrecord = integer.tostring(now.getyear()); // set string variable use name object studyrecord currentyearrecord = new studyrecord(); // name object string year got previous line. unfortunately, manipulating variable names @ runtime not possible in java language. kind of feature possible in dynamic languages, python or javascript. in plain java, can use map achieve need: map<string, studyrecord> records; // init map , fill when relevant studyrecord currentyearrecord = records.get(integer.tostring(now.getyear())) if need feature, have @ groovy , dynamic language running on jvm close syntax java.

Message with timeout in Visual FoxPro -

i need show message in wait window timeout. have managed following code: wait window 'message here...' timeout 1 if window clicked message disappear. instead have similar in such way if user clicks on message nothing happen , message stay visible (i.e. message close once timeout expires). can please me out here? wouldn't mind having similar (such messagebox) carries out same function. it sounds want display message , make user wait xx number of seconds before can continue. if case, this. local ltmessagetimeout m.ltmessagetimeout = datetime() + 5 while datetime() < m.ltmessagetimeout wait window "display message" noclear timeout 1 enddo wait clear

Extension objects to a class -

well discovered extension methods, extension methods allow extending methods , functionality existing type without needing change code : here // extending using extension methods static class myextensionmethods { public static int negate(this int value) { return -value; } } static void main(string[] args) { //using extension method int i2 = 53; console.writeline(i.negate()); } my question : is possible same thing object, example add int id form, can : form frm = new form(); frm.id = 2; yes, can create extension methods on type of class want. however, example not method property , cannot create extension properties. the following valid: static class formextensions{ public static void setid(this form form, int someid) { // someid here } } // call this: form frm = new form(); frm.setid(2);

c# - Trying to get the values of all child nodes -

my xml looks this: <names> <goodnames> <name>alpha</name> <name>beta</name> </goodnames> <badnames> <name>blabla</name> </badnames> </names> now trying value of child nodes belong goodnames or badnames. code i've tried far this: var goodnames = el in doc.root.elements("goodnames") select el.element("name"); unfortunately, returns first element, in case alpha. however, i'd name elements. if want names need this: var allnames = e in doc.root.descendants("name") select e.value; if want names or bad names, try kind of thing: var goodnames = el in doc.root.elements("goodnames") n in el.elements("name") select n.value;

javascript - Manage multiple scripts on single page application -

i developing single page phonegap application. using own custom logic (not using single page library). it have functionalities web service accessing , online - offline syncing , other phonegap features. i have 100 views , code. came across confusion, best solution achieve this. i generate html templates stored on main html page. remove view's html when swapping between views. 1) merge code in single js file. it may causes memory leak, , large amount of objects included in single js file. 2) add/remove script tag dynamically split application logic in view wise js files , dynamically add/remove script tag using jquery. also remove dom event listeners added. i suggest using backbone.js , underscore.js project. you can learn backbone.js here. http://backbonetutorials.com/

java - Copy dependency to war before packaging -

i'm packaging ear file maven ibm content navigator plugin project. product requires have ear, includes war, , war should include plugin jar in root of war. not in web-inf/lib. ear , war empty containers. i've created 3 projects, ear, web project, , simple java project. of these projects have pom. how can create war includes simple java project (jar) in root of war? not dependency must not end in web-inf/lib. thanks in advance, roeland bestman you need use maven-dependency-plugin 's copy goal , place jar in directory under target directory. you'll need include there war using maven-assembly-plugin .

android - Connect to a WiFi-Direct Network with a device which doesn't have the WiFi-Direct feature -

can android device doesn't have wifi-direct feature, connect other wifi-direct networks peer connected group owner (go) ? yes. legacy wi-fi devices such laptops can connect softap created due wifi direct. if have 1 wi-fi direct device can create autonomous group using wi-fi direct. group act softap laptop , visible 'direct-xxxx'. connect network using wifi , passphrase device. i not sure of above can done wifi interface given android, i've created application capable of doing above, yes above possible.

javascript - Google Analtyics adds hashtag to browser url on click? -

when adding google analytics our site, everywhere using hashtag example dropdown (bootstrap.js, jquery) of item, hastag gets added url in browser. there anyway remove this? using angulartics angularjs. for example, href="#collapsetwocheckout" results in http://yourdomain.org/#/collapsetwocheckout when removing ga script, goes away. ideas? thanks. it's not google analytics adds hashtag url, it's function in angular ng-route module. i'm not sure why occurs when have analytics loaded, can rid of hashtag removing ng-route module angular installation or set html5mode "true" in configuration of angular application. maybe should read this: https://stackoverflow.com/a/14320468/2274628

mysql - Cake model bake Error: The datasource configuration "493" was not found in database.php -

i’m using cakephp 2.4.1. i’m baking cake models having table name roles got following error on console creating file c:\wamp\www\projectnexus\app\model\role.php error: datasource configuration "493" not found in database.php it comes after look okay? (y/n) [y] > array(0) { } notice error: undefined offset: 0 in [c:\wamp\www\projectnexus\lib\cake\console\com mand\task\templatetask.php, line 79] previously, i’ve baked many models, time don’t know happen. tried bake baked models verification, giving me same error. connection okay because rest of application running smoothly. please help

windows - Chef-Repo Berkshelf? -

i wondering if out there can or advise me, on following i have single chef git repo, being windows guys i'm comfortable things git / chef etc, , want start splitting cookbooks out single repo's etc , allowing other people / teams manage them now there loads of documentation out there, none on how , install berkshelf. let me explain current setup /chef-repo /certificates /cookbooks /iis /sql /environments run git , gets pushed repo where i'm confused or lack of documentation or i'm might not getting it. i want each cookbook own repo ? happens above cookbook should existing in repo aswell ? e.g. databags / environments / roles / certs etc ..... or chef-repo, stays slim , install berkshelf in root chef-repo folder , manages cookbooks exist on machine e.g /chef-repo /berkshelf /cookbooks /mycookbook /yourcookbook /environments actually cookbook might exist i

windows phone 8 - How do I highlight area in a map? -

i want highlight area in map, can area (irregular shape). suggestions, how can achieve using 1. windows phone 8.1 map control 2. third party maps i can pushpins in map control, have highlight area. help appreciated? regards quick internet search returns following results: http://dotnet.dzone.com/articles/drawing-circles-windows-phone?utm_source=feedburner&utm_medium=feed&utm_campaign=feed:+zones/dotnet+%28.net+zone%29 http://dotnetbyexample.blogspot.com/2014/02/drawing-translucent-shapes-and-lines-on.html please more specific in questions next time. if doing research, try searching problem in internet before asking questions here. site answering concrete questions unable find solutions for.

c++ - How to initialize a union of pointers to nullptr? -

assume have c++ class this: class container { private: union { foo* foo; bar* bar; } mptr; }; this class constructed on stack. i.e. won't new ed, can't declare zeroing operator new . can use initializer in constructor set mptr nullptr somehow? container() : mptr(nullptr) { } does not compile. not adding dummy union member of type nullptr_t . container() : mptr.foo(nullptr) { } doesn't compile, either. use aggregate initialization, example: container() : mptr { nullptr } { } i don't posting links, here run through of technique.

java - Rotate two longs -

i'm working on block cipher algorithm , requirements state 128 bit key state (stored big endian) needs shifted 25 bits right. key state must 2 longs. here's latest attempt @ figuring out. shifted both upper , lower halves of key right 25 bits, stored new values in new longs rotated keys left 39 bits. xor'd first new upper key second lower key , stored in upper half of key, , did same other 2 shifted keys stored in lower half of key. idea behind being needs have 25 shifted bits @ front of upper half of key. long rotkeyupper = keyupper >> 25; long rotkeylower = keylower >> 25; long rotkeyupper2 = keyupper << 39; long rotkeylower2 = keylower << 39; keyupper = rotkeyupper ^= rotkeylower2; keylower = rotkeyupper2 ^= rotkeylower; keyupper |= keylower; does make sense? edit: yes did mean rotate. , clarify, "rotkeyupper" , "rotkeylower" longs store rotated bits - keyupper , keylower 2 longs actual key - sorry confusion.

actionscript 3 - Flex 4 - How to check NumericStepper value is NaN or not? -

i using numericstepper in application. want check numericstepper nan or not? , don't want check (!value). 1 of restriction application. have check numericstepper value nan or not. there isnan function checks need. check here more info: http://help.adobe.com/en_us/as2lcr/flash_10.0/help.html?content=00000571.html

javascript - checking TimeStamp for LocalStorage record -

i have got div dynamic content: <div id="news">test</div> and want add content localstorage 50 sec prevent new requests server , if older 50 sec remove , set new content. jquery is: $(function(){ function now() {return+new date} var db = window.db = { : function(key) { var entry = json.parse(localstorage.getitem(key)||"0"); if (!entry) return null; if (entry.ttl && entry.ttl + entry.now < now()) { localstorage.removeitem(key); return null; } return entry.value; }, set : function( key, value, ttl ) { localstorage.setitem( key, json.stringify({ ttl : ttl || 0, : now(), value : value }) ); } }; }); $(function() { // set value ttl of 50 seconds using milliseconds. db.set( "homenews", $("#news").html(), 50000 ); }); $(function() { var contentsofnews = db.get("homenews"); $("#news").html(contentsofnews); });

where to find chrome apps directory r/w api? -

i read http://www.marshut.com/yyhrq/brackets-as-a-chrome-app-with-live-development-directory-access-demo-inside.html chrome app has brand new directory r/w api. know find documentation it? thanks you can find info on chrome.filesystem here , how hold of directoryentry objects. can find info on how use these here . there sample app tying these both here .

web parts - Bug in visual studio? -

i developing web part sharepoint in visual studio. web part displays record database. there line of code containing jquery/javascript code. commented it, , records have stopped displaying. undid action code still report not showing now. i have tried restarting servers, database, iis no luck. used different browsers , cleared cache several times. report doesn't show though commented 4, 5 lines code, uncommented it. that's it. no error, exception being shown. has encountered this? do in case? edit way happened twice on 2 different sharepoint farms. same code, commented lines, compiled code, report not shown, uncommented lines, recompiled code, no error report not shown. turns out it's not bug silly mistake me. fixed!

php - Cakephp 2.x #hash not working in pagination number -

i have problem use hash(#) tag in cakephp pagination number. my code: <?php echo $this->paginator->prev(' <<' . __('prev '),array('url'=> array('#' => 'grid')),null,array('class' => 'prev disabled')); echo $this->paginator->numbers(array('separator'=>'')); echo $this->paginator->next(__(' next') . '>> ',array('url'=> array('#' => 'grid')),null,array('class' => 'next disabled')); ?> i getting hash( #grid ) tag in both <<prev , next>> unable give #grid in between number. please me how use hash link in pagination number? test link - http://vanceblackburn.com/demo/carscanner/cars/listing/?make_id=&price1=&price2=&state_id=&title= <?php echo $this->paginator->prev(' <<' . __('prev '),array('url'=&

php - Sharing custom data to facebook/linkedin -

i want user able share(post) data facebook/linkedin page. there facebook sharer link supposed deprecated now? tried this doesn't work entirely. there share button need link html without additional mess. people seem sharrre think there should easier solution. i noticed there 2 different aspects when trying share data: pre create text put share textbox (this works twitter sharrre instance, not fb/linkedin… ) use url put sharer , sharer automatically detects properties such title,image,description (text stays blank , it's user write something) what current best , fastest way share info page facebook and/or linkedin? (without using generated share buttons) ##### edit: figured out linkedin. can use https://www.linkedin.com/cws/share?url=your_url?your_parameter=param_value and able show param onward php $_get instance , put in <meta property="og:description" content="this param <?php echo $_get['your_parameter'] ?>"

bash - Open shell in Python -

this question has answer here: calling external command in python 44 answers how can open in python unix shell, type command , other inputs , close unix shell? example commands , inputs: telnet 127.0.0.1:6000 user pass save-all restart greets miny you can have @ pexpect module , more precisely interact function. see documentation here . basically, juste spawn sheel, program or whatever want, , interact do. import pexepect p = pexpect.spawn('/bin/bash') p.interact() then escape escape character explained in doc.

outlook startup code does not work -

i have got code in "thisoutlooksession" private sub application_startup() set objinspectors = outlook.inspectors dim onamespace outlook.namespace dim myrecipient outlook.recipient dim folder outlook.mapifolder set onamespace = outlook.getnamespace("mapi") msgbox ("startup works") and quite lot of code.... but not start, not msgbox "startup works" @ all. if start sub manually f5, goes fine. any ideas, why not work? thanks max appears unusual: set onamespace = outlook.getnamespace("mapi") try: set onamespace = application.getnamespace("mapi")

OCaml recursive function int list -> int -> (int list * int list) -

studying midterm , looking through old exam questions. 1 doesn't have solution posted , stumping me: partition : int list -> int -> (int list * int list) divides first argument 2 lists, 1 containing elements less second argument, , other elements greater or equal second argument. partition [5;2;10;4] 4 = ([2], [5;10;4]) oh, , i'm supposed able find solution without using auxiliary function here far i've gotten: let rec partition l n = match l | [] -> ([], []) (* must return type *) | x :: xs -> if x < n (* append x first list, continue recursing *) else (* append x second list, continue recursing *) normally, i'd use aux function parameter store pair of lists i'm building, can't done here. i'm bit stuck you should use let in construction match return value of recursive call: let rec partition l n = match l | [] -> ([], []) | x :: xs -> let a, b = partition xs n

html - how to make image scale automatic to screen -

i'm making webpage wordpress think need maintenance page during design. beginner make under construction page photoshop. posted image big. image size 1920*1028 , use "simplest" theme. want no x-scroll, 1 page image @ 1 time. there ways do? pleas let me know. <html lang="ko-kr"><head> <meta charset="utf-8"> <link rel="profile" href="http://gmpg.org/xfn/11"> <link rel="stylesheet" type="text/css" media="all" href="http://graphicnet.kr/wp-content/themes/simplest-child/style.css"> <link rel="pingback" href="http://graphicnet.kr/xmlrpc.php"> <title></title> <link rel="alternate" type="application/rss+xml" title=" » 피드" href="http://graphicnet.kr/?feed=rss2"> <link rel="alternate" type="application/rss+xml&qu

php - Different menus for different user roles -

i'm trying display 2 different menus depending on user role. i have setup new role called 'clients' using code (in functions.php): add_role( 'client', 'client', array( 'read' => true, ) ); and have 2 different menus using code (in functions.php): function register_my_menus() { register_nav_menus( array( 'client-navigation' => __( 'client navigation' ), 'staff-navigation' => __( 'staff navigation' ), ) ); } add_action( 'init', 'register_my_menus' ); here code i'm trying use call either client navigation or staff navigation (in header.php): <?php if (current_user_can('client')){ //menu client role wp_nav_menu( array('theme-location' => 'client-navigation' )); }else{ //default menu wp_nav_menu( array('theme-location' => 'staff-navigation' ))

inheritance - php multiple derived and parallel inherited classes -

for example wan't make "base" class, , extend as possible, , make super class have extended methods. class base { private $name; public function __construct($name) { $this->name=$name; } public function getname() { return $this->name; } } class extenda extends base { private $surname; public function __construct($surname) { $this->surname=$surname; } public function getsurname() { return $this->surname; } } class extendb extends base { private $lastname; public function __construct($lastname) { $this->lastname=$lastname; } public function getlastname() { return $this->lastname; } } class maximal ??? { .... ??? } $object=new maximal('name','surname','lastname'); $object->getname(); // name base class $object->getsurname(); // surname extenda class $object->getlastname(); // lastname extendb class this possible if follow line-by-line inheritance a, b ext a, c ext b. if wan'