Posts

Showing posts from January, 2013

jquery - javascript variable to call object function -

this question has answer here: dynamically access object property using variable 10 answers i'm new oop, please excuse me if terminology off. i'm trying use function parameter call object argument. i think more understandable sample code: js $(".color").click(function() { var newcolor = $(this).attr("data-color"); functions.colors.show(newcolor); }); var functions = { colors: { show: function(newcolor) { $("h1").text(mytexts.test.newcolor); } } } // end functions var mytexts = { test: { red: "bright red", green: "grassy green", blue: "sky blue" } } // end texts as can see, i'm trying get, say, "sky blue", show inside h1. however, when click, say, show "bright red", not working

c# - Process each line separately in selected text -

i'm trying select set of lines , process each line separately in text document using c# language. how can separate lines process? tried these codes , got struck. can please me this? envdte.dte dte = mypackage.mypackagepackage.getglobalservice(typeof(envdte.dte)) envdte.dte; envdte.textselection text = (dte.activedocument.selection envdte.textselection); if reading text file code you: string filetoread = "d:\\temp.txt"; // temp.txt file read if (file.exists(filetoread)) { streamreader reader = new streamreader(filetoread); { textbox1.text += reader.readline() + "\r\n"; // read each line , pass textbox1 } while (reader.peek() != -1); reader.close(); // close file }

c++ - Program feedback: named loop index and reference to constant data -

i had class assignment teacher took off points lot of things agree with, couple of them i'm not sure about. "i not fan of naming variables i, when in fact counter represents real thing, port number:" "it better call portnum, or like." in response following lines: for(int = 1; <= boat.getlastport(); ++i){ boat.load(); boat.move(i); boat.unload(); } my first question is, sound advice, or not worthwhile? see named loop variable. thought people instantly know what's happening in situation 1 (in context of rest of program). second , last feedback: "first, method names need start lowercase letters, not uppercase. strong convention in oop. worse, there no reason pass in range value reference. requested value returned, how methods work each other." --- "...no program wants call class method , pass in reference: never trust class program variables. use pass-by-value in methods." this quote refers member fun

Getting the documents in the specified order from MongoDB using C# driver -

Image
this question has answer here: does mongodb's $in clause guarantee order 9 answers i new mongodb , wanted know whether possible fetch documents id in order have specified in array. using official c# driver. problem description i have documents in collection this { "_id" : "1", "name" : "assignment 1" } to { "_id" : "100", "name" : "assignment 100" } i have array of ids { "4", "19", "10", "6" } , need fetch documents specified in same order in array. these queries tried { "_id" : { "$in" : ["4", "19", "10", "6"] } } { "$or" : [{ "_id" : "4" }, { "_id" : "19" }, { "_id" : "10" }, {

vhdl - Is there any documentation for Xilinx (ISE) filter files? -

i'm looking documentation on xilinx ise *.filter files. here short example of message/warning/error filter entry: <filter task="xst" file="hdlcompiler" num="1127" type="warning"> <arg index="1">button_center</arg> </filter> in case interpretation easy: filter xst message warningid 1127 , severity warning cause design entity "button_center". this can extended filtering wildcards: <arg index="1" match_type="wildcard">atacapability_*</arg> so arg-tag extended match_type , tag value has wildcards. understandable. but in cases there several arg-tags in 1 filter-tag: <filter task="xst" file="xst" num="1896" type="warning"> <arg index="1" match_type="wildcard">lcdbuffer_d*</arg> <arg index="2">0</arg> <arg index="3" match_type="wil

Parse Push Notification for Android in Titanium -

i found solution in ios rest api... but... how same in android? solved this? or found kind of workaround? https://marketplace.appcelerator.com/apps/7889#!overview - module not available in appcelerator market. i tried below module https://github.com/programmerdave/titanium-parse-module-prereleases but module not worked. please me solve it. thanks unfortunately parse uses own gcm sender id. impossible use normal gcm module fetch devicetoken , share parse via rest api, on ios. (my previous answer invalid, apologies!) i created titanium module android push notifications working, not yet 100% finished. receive push notifications, not yet signal/event when clicks on notification. working on module , have complete implementation within couple of days. (i need project well). the module can found at: https://github.com/timanrebel/parse please use version 0.2 working. module open source , master ahead of release 0.2 , includes new android sdk parse. appreciated!

Kafka multiple producer writing to same topic - Ordering of message and data burst -

i trying learn kafka. have multiple producer each writing same topic. (cant have more topics because of design , using avro serialization) because our message big, need divide small parts , send kafka. in scenario - can mesages different producers can intermix ? how can avoid scenario ? ideas also , have huge databurst, there 1000s of message in 2 minutes, few message next 5 7 minutes, can in such scenarios because our message big, need divide small parts , send kafka. do you? runned basic tests , had issues? have tried adjust buffers? i'm pretty sure kafka can handle relatively big messages (tens of megabytes) without hassle. in fact, better throughput, comparing huge number of tiny messages. also , have huge databurst, there 1000s of message in 2 minutes, few message next 5 7 minutes, can in such scenarios single kafka broker on modern server machine can handle ~20k-40k messages/ per second (batched of 1000 messages, each 2k size, sync mode). don&

java - programmatically control cursor and text in EditText -

i have edittext box in want control cursor , modify text programmatically i have 12 button keypad made using 12 buttons in gridview. each button press have specific text inserted in edittext box @ cursor position. need cursor position can insert custom text in edittext view i have 2 buttons moving cursor position left/right 1 character. alternatively cursor can set touching edittext view (as edittext supposed behave) also want current position of cursor in edittext whenever cursor position changes (i think have implement kind of interface dont know how) what have tried far i storing key presses in arraylist<string> i setting edittext.settext(string) everytime key pressed can editable text through gettext() settext() accepts strings. hence confused. should fulfill requirements. ps: android beginner, , making 2nd app (which scientific calculator if helps) if volunteers review code, i'll obliged him to set number in edittext use wrapper

android - Face book application not reviewed successfully -

Image
i developing face book application user fetch wall,tagged,group , pages video. working fine on admin account, not working on other account. submitted application review yesterday, today got message (in picture below).

ios - Xamarin Studio creates files with wrong namespace -

i'm using xamarin studio , i'm developing app mvvmcross framework. my issue that, when try create new file in folder named "views", namespace not contain ".views". i have xamarin.client.ios instead of xamarin.client.ios.views. mvvmcross framework doesn't find views , return keynotfoundexception : not find view [myviewmodel] i wonder if xcode modified namespaces because app worked , can't find views. i guess it's namespace problem not sure. fact "view" files not in ".views" namespace while in "views" folder. how can create views namespace ? because changing in .cs , .designer.cs file not fix keynotfoundexception... if have idea... in xamarin studio, preferences --> source code --> .net naming policies check "associate namespaces directory names" if want classes include folder name in namespace default.

bootstrap-sass 3.2 compass watch doesn't compile -

i have following gems installed (on windows): sass 3.3.8 (maptastic maple) compass 1.0.0. alpha.19 bootstrap-sass- 3.2.0.0 when run command: compass create my-new-project -r bootstrap-sass --using bootstrap the folder project created, when run compass watch on error: wdm::error on line [73] of c: can't absolute path passed directory: '' ! run --trace see full backtrace you should run gem update after them make compass clean compass watch run fine :)

javascript - PHP page change text into constants -

i have php site , want make multilingual. there way parse php pages , find text , replace similar php constants? want make automatic script first find php pages inside find nodes having text inside , replace php constatnt , @ same time add new entry of constant database. there lot ways. suggest do like before: <title>hello world</title> after: <title><?=ts("hello world");?></title> then write function ts($source) which cares output right string. easy , comfortable because can continue coding page in english or language , ts() caring everything

javascript - Invoking Main Controller function from Modal Controller - AngularJS -

problem summary want invoke getcost function present in main controller, modal controller. pseudo-code explain problem follows. i am opening modal dialog follows: .... //i want invoke getcost function modal controller //so pass via 'resolve' $scope.getcost = function() { return i*x+y;//calculates , returns cost } $modal.open({ templateurl: '/html/mymodal.html', controller: mymodalctrl, resolve: { getcostnow: function () { return $scope.getcost; } } }); ..... and in mymodalctrl like: var mymodalctrl = function($scope, $modalinstance, $http, getcostnow) { function updateorder() { //trying invoke getcost function reference here //but not work. var thecurrentcostis = getcostnow(); } } try (notice scope:$scope): $modal.open({ templateurl: '/html/mymodal.html', controller: mymodalctrl

blocking - My http request block,what 's wrong? -

Image
i view homepage in chrome, 1 http request, , encounter case. what 's wrong? i can see dns not found when happened, it's not bug of server. so chrome @ moment. from: https://groups.google.com/forum/?fromgroups=#!topic/speedtracer/mlf_gtvmrd8 the 'blocked' time delta between 'requesttime' , 'starttime'. basically, measure of amount of time between ui thread initiating request network resource , http request bits getting onto wire. in between, there can internal queuing/message passing delay, cache lookup, dns resolution, , tcp connection setup. among causes mentioned, sounds dns lookup 1 take long. dns lookup succeeded, otherwise whole request have failed. here's 1 possible cause of dns delay: http://www.bigthinka.net/support/web-browsers/google-chrome-slow-dns-resolving.html if doesn't solve it. try updating question more info dns settings.

c# - How can I get the content of 2 columns and show this? -

public void showfirstfivehighscore() { string query = "select 'key', 'playername', 'highscore' playerpoints order highscore desc limit 5"; if (this.openconnection() == true) { mysqlcommand cmd = new mysqlcommand(query, _connection); mysqldatareader reader = cmd.executereader(); while (reader.read()) { messagebox.show(reader.getstring(...); } cmd.executenonquery(); this.closeconnection(); } } i try show columns "playername" , "highscore". maybe in messagebox? help? thanks. first of all, don't need use single quotes ( ' ) column names when call them in select part in query. need use character values. second of all, mysqldatareader.getstring method takes int parameter zero-based column number. means can specify columns 1 , 2 , show them want. key reserved w

json - how to parse array inside object through gson in android -

i want parse array inside object through gson.. example { 'title': 'java puzzlers: traps, pitfalls, , corner cases', 'isbn': '032133678x', 'authors':[ { 'id': 1, 'name': 'joshua bloch' }, { 'id': 2, 'name': 'neal gafter' } ] } i able parse object i.e. title, isbn , got value don't know how value of authors? please ,i using json parsing through gson in android.. arraylist<authors> lauthors = new arraylist<authors>(); list<authors> list = new gson().fromjson(json, lauthors.getclass()); (object : list) { system.out.println(a); } this give values in class author's object. public class author{ int id; string name; //getter setter here } hope helps.

Facebook API reading comments attachments -

my trying find way read comments attachments. status update looks like: http://screencast.com/t/sxqoza3osf there's attachment message "mitt bidrag". i'm getting correct json-stream using "me/feed" it's missing information attachment. feed looks like: http://screencast.com/t/sel2iesvowu i've tried bunch of fql-commands comment/attachment-table i'm retreiving. here examples of i've tried: - select id, text, time, fromid comment object_id='100002055769071_617700241641829' , parent_id='0' - select id, text, time, fromid comment object_id='617700241641829_653988868012966' , parent_id='0' - select post_id, user_id post_id = "617700241641829_653988868012966" - select message stream post_id = "617700241641829_653988868012966" response is: { "data": [ ] } anyone have solution? thanks lot. try use fql query comment details based on post id: select id, text

java - Hibernate does not accept ManyToOne as Id -

hibernate not agree construction. missing anything? error throws me: org.hibernate.mappingexception: unable find column logical name: version_id in processes any suggestions on how fix while keeping composite key structure? datamodel version has many actions version has many processes; public class version { @id @column(name = "id") public int id; } action has 1 process action has 1 version public class action { // action has composite key (id , version id) @id @column(name = "id") public int id; @id @manytoone @joincolumn(name = "version_id") public version version; @manytoone @joincolumns({ @joincolumn(name = "process_id", referencedcolumnname = "id"), @joincolumn(name = "version_id", referencedcolumnname = "version_id") }) public process process; } process has many actions process has 1 version public cla

PHP Laravel 4 Array to nested JSON -

i using laravel 4 . @ beginner stage not aware of features of php laravel framework. i have array fetched table below : $result = model::all(); that gives : [0]=>[ [id]=>1 [name]=>"abc" [description]="temp" [tempfield1]="t1" [tempfield2]="t2" [tempfield3]="t3" ] [1]=>[ [id]=>1 [name]=>"xyz" [description]="temp2" [tempfield1]="t21" [tempfield2]="t22" [tempfield3]="t23" ] ... , on. now, want generate json array : "items":[{ "id": 1, "name":"abc", "description":"temp", "temps":[{ "temp1":"t1", "temp2":"t2", "temp3":"t3", }] }, { "id": 2, "name&

xml - How do I initialize an IXMLDOMNode in VBA? -

when use code in excel vba macro: dim xmlknoten new ixmldomnode i error. how initiate right? the initiation of domdocument works: dim xmldoc object set xmldoc = createobject("msxml2.domdocument") thanks helping. first, ensure have microsoft xml reference enabled (my version v3.0 ). once have enabled, code should work, if doesn't can write this: dim xmlknoten new msxml2.ixmldomnode hope helps.

css - Aligning content in html table -

i want align content in html in not able it. want align checkbox right , align second textbox here html <table> <tbody> <tr> <td >age</td> <td > <select ></select> </td> </tr> <tr > <td >date changed</td> <td> <input /> <input /> </td> </tr> <tr> <td class="test">name</td> <td> <input id="txt1" /> </td> </tr> <tr class="space"> <td class="test">is ok</td> <td> <input id="chk" type="checkbox" /> </td> </tr> </tbody> </table> h

java - When Click on Hyperlinks in JavaFX ,a relevant URL should open in browser -

i developing application in have links added listview , these links keep on adding @ runtime on condition.so can't find way how open url when clicking on particular link. this code adding links list view if(counter==1) { task task2 = new task<void>() { @override public void call() throws exception { platform.runlater(new runnable() { public void run() { link=new hyperlink(val); link.setstyle("-fx-border-style: none;"); items.add(link); listview.setitems(items); } }); return null; } }; thread th =

javascript - HTML select a row under the <td> tag in UIWebView -

i have uiwebview in have loaded htmlstring contains text in table format under tag. tag inside tag. under tag. need change color of text on tap. code : <tr id = '1' valign=\"top\"> <td> <p> <a href = '#1'> text </a> </p> </td> <td> <p> <a href = '#1'> translation </a> </p> </td> </tr> what need when tap on "text" or "translation" text color should change. i writing javascript code change color. <script> var el = document.getelementbyid(\"%d\"); window.onload = function () { window.scrollto(20,el.offsettop); el.style.color=\"red\"; } </script> please help. update: this html file replacing above given "tr" tag ###content### <html> <head> <style type='text/css'> a:link {

Azure Powershell website cmdlet's not working correctly on server -

i setting deployment of azure website on build server running server 2012. i first tried deploy local machine using following steps (and worked): install azure powershell using wpi use get-azurepublishsettingsfile command , import-azurepublishsettingsfile access azure websites etc powershell run command get-azurewebsites , see list of websites run publish-azurewebsiteproject publish package website all above works. however, when follow same steps on server, when get-azurewebsites step, nothing back. follow on this, when try , run publish command, "website not exist" error. if run get-azureaccount , get-azuresubscription commands, correct account / subscriptions. i have no idea going on?! check if there more 1 azure subscriptions on server. if there more, make sure subscription need set default. use command: select-azuresubscription -default 'subscription name' ... set default subscription.

c# - 2 columns window with built-in keyboard -

hi build app running on windows 7 using wpf 2 columns 1 column virtual keyboard or on-screen keyboard (osk) , other column content of app. the keyboard appear on every page/window of app. keyboard pretty simple, alphabet , numeric buttons such enter , del. questions are: how create 2 columns on window? is there free use keyboard attach project? , how can create own virtual keyboard? how make virtual keyboard appear on every window? building 2 columns simple. add grid 2 columndefinitions this <grid> <grid.columndefinitions> <columndefinition width="auto" /> <columndefinition width="*" /> </grid.columndefinitions> <keyboard grid.column="0" /> <customcontent grid.column="1" /> </grid> for keyboard control, can have @ this link also, if don't want implemented complex thing, can open onscreen keyboard using - public void checkkeyboard() {

My mixed Scala/Java Maven project doesn't compile -

i have mixed scala/java project doesn't compile well. the problem arises when java code trying call scala code in same package. of course, have standard layout: src/main/java src/main/scala src/test/java src/test/scala i've looked @ other similar stackoverflow questions this question little outdated. other question doesn't either. i have followed scala-maven-plugin documentation page . <build> <pluginmanagement> <plugins> <plugin> <groupid>net.alchim31.maven</groupid> <artifactid>scala-maven-plugin</artifactid> <version>3.1.6</version> </plugin> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-compiler-plugin</artifactid> <version>2.0.2</version> </plugin>

apache - Lucence SOLR not highlighting special characters like dot, slash in search result -

like in titile, got result solr , special characters not highlighting in searching word <em>00</em>:<em>00.000z</em> solr parameter &hl.simple.pre=<em>&hl.simple.post=</em> example query: all:* , hello/world <em>hello</em> / <em>world</em> field analyzer: <fieldtype name="text_en" class="solr.textfield" positionincrementgap="100"> <analyzer type="index"> <tokenizer class="solr.standardtokenizerfactory"/> <!-- in example, use synonyms @ query time <filter class="solr.synonymfilterfactory" synonyms="index_synonyms.txt" ignorecase="true" expand="false"/> --> <!-- case insensitive stop word removal. add enablepositionincrements=true in both index , query analyzers leave 'gap' more accurate phrase queries. --> <filter class="

html - Riverbed Stingray steelapp, displaying a image on a maintenance page -

we have setup our application on riverbed stingray, 1 of requirement display maintenance page when administrator wants update system. so created html page logo image , uploded both .html , .png image file/ miscellaneous path. created rule, in rule added below trafficscript has hardcoded html file name uploaded miscellaneous path. , when try access website displays maintenance page, image added in maintenance page not displayed. if dont hardcode .html file name use http.getpath() , file name , use navigation(commented in script), image displayed fine. if can please point me if there problem or if there better way this. <!doctype html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>sorry</title> </head> <body> <img src="/.extra/test.png"> <h1>our apologies</h1> we're sorry. of our operators busy. please try again later. </body> </html> the traffics

javascript - Add Facebook Share Button on IP Board -

i want add facebok share button on ip board 3.4.5 forum i try use integrated way in ip board, not seem work. i tried several ways, include one: <a name="fb_share" type="button_count" expr:share_url="data:post.canonicalurl" href="http://www.facebook.com/sharer.php">share</a><script src="http://static.ak.fbcdn.net/connect.php/js/fb.share" type="text/javascript"></script> but cant find somthing working on forum. each post gives error. any ideas?

ios - UISearchBar Overlays UITableView - TableView Can't be moved -

i've got tableview , search bar set , both work fine far. problem uisearchbar overlays first item of tableview. i cannot use xib or storyboards in project. the definition , instantiation of tableview in galaxy in class (imported class import...) far, far away -- not easy access. i move (instantiate) searchbar on screen with: self.searchbar = [[uisearchbar alloc]initwithframe:cgrectmake(0, 0, 320, 44)]; [self.view addsubview:self.searchbar]; self.searchbar.delegate = self; i tried moving 0,-44 screen not stay @ searchbar, moves down. if try move uitableview with: self.tableview.frame = cgrectmake(0, 0, 320, 500); it moves searchbar well. so let's if set origin of search bar @ 0,0 , origin of table view @ 0,44 screen (objects in order): grey space height of search bar/table view cell search bar (still overlaying first cell of table view other cells how can solve problem? think easiest way add empty object data array search bar overlays nothing of im

tsql - Performance of SQL Query killed by join -

Image
we have problem performance of query in sql server 2008 r2. query joins tables 2 databases, 1 our data mart getting data iseries system, , 1 our main reporting system. in below query should 90939 records in less 30 seconds. if remove column po.powner, results come in 10 seconds. but when add po.powner column killing it. select cu.* ,c4.c4ind, cu.cus_citizenship [country of incorporation], cu.cus_nationality [residence country],[firstparticipantid]=isnull(po.powner,cu.cus_no) -- , cu.cus_no collate latin1_general_cs_as, po.powner collate latin1_general_cs_as dbo.customerdata cu left outer join hermes_import.dbo.kfildto_c4pf c4 on cu.cus_type collate latin1_general_cs_as =c4.c4ctp collate latin1_general_cs_as outer apply ( select top 1 case when gfctp = 'gg' , len(y41scv) > 5 y41scv else y41cus end 'powner', gfctp hermes_import.dbo.kfildto_y41pf inner join hermes_import.db

android - How to restrict user from choosing past dates from date picker? -

i using date picker set alarm allowing user set dates before current date here code set date picker public void onclick(view v) { new datepickerdialog(reminderdetailactivity.this, date, mycalendar.get(calendar.year), mycalendar .get(calendar.month), mycalendar .get(calendar.day_of_month)).show(); } can tell me hoe restrict user going past dates thank in advance you use this. calendar c = calendar.getinstance(); int todaysdate = c.get(calendar.date); public void onclick(view v) { new datepickerdialog(reminderdetailactivity.this, date, mycalendar.get(calendar.year), mycalendar .get(calendar.month), mycalendar .get(calendar.day_of_month)).show(); if(todaysdate < date){ toast.maketext(activity.this, "choose future date",toast

ios - Using "Alternate Tier 1" in Apple In-App Purchases -

i developing app swedish client , want implement in-app purchase. in app sell credits. price of credit should 99 sek. selected "alternate tier 1". when try purchase credit, shows price in usd 0.99 usd default. problem is: how can change swedish currency 99 sek? i request product details this. - (void)requestproductswithproductidentifiers:(nsset *)productidentifiers { _productsrequest = [[skproductsrequest alloc] initwithproductidentifiers:productidentifiers]; _productsrequest.delegate = self; [_productsrequest start]; } i receive price in usd, wondering how can price in sek. the price that's shown dependent on country itunes account set to. can create test users in itunes connect can try out yourself.

java - Does Colt provide "d-dimensional" matrices? -

colt library pretending provide "dense , sparse fixed sized (non-resizable) 1,2, 3 , d-dimensional matrices" (section features / templated multidimensional matrices ). but in api see no implementation, higher 3: http://acs.lbl.gov/acssoftware/colt/api/cern/colt/matrix/package-summary.html please cure tired eyes :)

path of the directory where ibooks's pdf stored ios -

i need existing pdf files in device , upload selected pdf server. i've added 1 pdf file ibooks , tried searching file in directory using code: nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes); nsstring *documentsdirectory = [paths objectatindex:0]; nsfilemanager *filemanager = [nsfilemanager defaultmanager]; //nserror *error = nil; nsarray *filesatpath = [filemanager contentsofdirectoryatpath:documentsdirectory error:nil]; nslog(@"filesatpath:%@",filesatpath); (nsstring *path in filesatpath) { nslog(@"add.."); if ([path rangeofstring:@".pdf"].length > 0) { //do whatever want pdf file nslog(@"pdf: %@",path); } } but log shows empty array, please tell me, there other method pdf list in device , select 1 upload in server.

android - Crouton depends on libraries but is not a library itself -

i'm using android studio 0.6.1, crouton library , today after gradle sync got next error: error:a problem occurred configuring root project 'project_name'. module version de.keyboardsurfer.android.widget:crouton:1.8.4 depends on libraries not library that's going on? this issue due com.android.support-v4 recent update. so changed compile 'com.android.support:support-v4:20.+' to compile 'com.android.support:support-v4:19.1.+' and crouton works fine different workaround use @aar: compile('de.keyboardsurfer.android.widget:crouton:1.8.4@aar') { exclude group: 'com.google.android', module: 'support-v4' }

javascript - Adding AJAX forms inputs together, on user update -

update 3 james, mondaytotal, class in span tags, like, <span class="timebreakdowntotalweek">mon</span> <span class="mondaytotal">0</span> update 2 this function loads whole week, monday though sunday, , gives total. have tried, function changing '.totalhours' class mondaytotal, loads weekly total var. next add 'monday' before +count, seems add current rows monday mondaytotal class. so example, have 3 rows with, '.monday0', '.monday1' , '.monday2'. monday total, hold total value, overrides when enter next value. enter 1 monday0, mondaytotal 1 when enter 2 monday1 instead of mondaytotal being 3, overrides , holds 2 - not add rows together. i think due (at lest way see it, please correct me if wrong), 'index' each time resets 0 , not loop right. var loadhourtotals = function(count) { if (typeof count === "undefined" ) { var $total = $('.totalhours

Javascript - replace string basing on array -

i've got mystring = "google" , i've got array myarray = ["o", "o", "e"] i want mystring.replace(myarray, "<b>$</b>") so return g<b>o</b><b>o</b>gl<b>e</b> - every comming matching letter array wrapped in tag. i have proper regexp /.*?(o).*?(o).*(e).*/i have matching groups o followed o followed e. those arrays , strings auto generated (fuzzy search) i'm not able how big array , strings be. know letters in string. you can do: mystring = "google"; myarray = ["o", "o", "e"]; var r = mystring.replace(new regexp( '(' + myarray.join('|') + ')', 'g'), "<b>$1</b>"); //=> g<b>o</b><b>o</b>gl<b>e</b> edit: based on discussions below: mystring = "google"; myarray = ["g", "o", "e&q

jsf - JSF2.2 Templating site menu with <ul> -

using jsf2.2 have list menu in maintemplate this: <ul> <li class="selected">home</li> <a jsf:outcome="new"><li>new</li></a> </ul> i want put class="selected" according jsf current page, otherwise puts link. what best practise? thanks attention. have nice day. this way worked: <h:panelgroup rendered="#{view.viewid == '/new.xhtml'}"> <li class="menuselected">new</li> </h:panelgroup> <h:panelgroup rendered="#{view.viewid != '/new.xhtml'}"> <a jsf:outcome="new"><li>new</li></a> </h:panelgroup> is practise? don't work using bean. (sorry english)

linux - SMSC9514 is not detected on Beagleboard xm rev C -

i using linux kernel 3.2.0. ethernet works fine in uboot once control transfered kernel, see 3 ports found in boot logs no log finding 5 ports hub. log @ end of post. i came accross posts , tried verify if proper voltage being given lan9514 chip. tested following commands 2cget -f -y 1 0x4b 0x76 to vaux2_dev_grp, , i2cget -f -y 1 0x4b 0x79 to vaux2_dedicated, , i2cget -f -y 1 0x4a 0xee to leden. 0x2e , 0x05 first 2 , third value 0x22 (0x11 should ideal value turn on 3.3v smsc). ethernet works fine when use prebuilt image kernel 2.6.32. means hardware fine works here , in u-boot. can me in finding out change leden value in linux kernel. [ 1.548950] usbcore: registered new interface driver asix [ 1.555664] usbcore: registered new interface driver cdc_ether [ 1.562774] usbcore: registered new interface driver smsc95xx [ 1.569641] usbcore: registered new interface driver net1080 [ 1.576446] usbcore: registered new interface driver cdc_subset [ 1.583312] u

ios - iOsOpenDev SpringBoard -

can tell me how hook springboard method, appslider method iosopendev (ios 7.1). don't know framework have take. i have tryed nothing appeared on console: import uikit/uikit.h import springboard/springboard.h import "captainhook.h" chdeclareclass(sbappsliderscrollingviewcontroller); choptimizedmethod(0, self, void, sbappsliderscrollingviewcontroller, loadview) { chsuper(0, sbappsliderscrollingviewcontroller, loadview); nslog(@"ciccia!"); } chconstructor { @autoreleasepool { chloadlateclass(sbappsliderscrollingviewcontroller); chhook(0, sbappsliderscrollingviewcontroller, loadview); } } why need chloadlateclass(sbappsliderscrollingviewcontroller); //for class available later you can write chloadclass(sbappsliderscrollingviewcontroller);//for class available ;) and can using logos.. here example... #import <uikit/uikit.h> %hook sbappslidercontroller - (void)loadview { %orig; nslog (@"

python - Auto_increment custom Primary Key in Peewee model -

i want primary key id field bigint class tweets(model): id = bigintegerfield(primary_key=true) ... but needs auto_incremented , can't find way in peewee docs. please suggest if it's possible. update: i'm using mysql db. peewee automatically generates integer id column serving primary key, having auto_increment property. true table create peewee. it integerfield enough needs; bigintegerfield useful. need numbers bigger 2147483647? insert more 2 billion rows? see: http://dev.mysql.com/doc/refman/5.5/en/integer-types.html

javascript - Ajax - Manipulate a correct array to pass to PHP -

hi guys new jquery , have encountered type of problem, i trying create array jquery pass on php controller (ci). sample html <input type="text" acc_id="5" class="input" /> <input type="text" acc_id="10" class="input" /> <input type="text" acc_id="15" class="input" /> <input type="text" acc_id="20" class="input" /> javascript $('#save').click(function(){ var arrayval = []; $('.input').each(function(key, value){ var id = $(this).attr('acc_id'); var inputvalue = $(this).val(); arrayval[id] = inputvalue; }); $.ajax({ url: siteurl + '/sample_save', type: 'post', datatype: 'json', data: {'accounts' : arrayval}, success: function(data) {} }); }); here response in php array ( [array]

xml - Using XMLTYPE to find repeating nodes -

i have piece code want use repeating nodes. far have manage hard code substring find value firstname , surname name type = 'spelling variation'. other attempts have failed various errors , null values being returned. there way without have supply [1], [2], [3], [?] @ all. many info passed on. -------------------------------------------------------------------------------------- declare x xmltype := xmltype('<?xml version="1.0" ?> <records> <person id="34463" action="chg" date="23-nov-2009"> <gender>female</gender> <activestatus>inactive</activestatus> <deceased>no</deceased> <namedetails> <name nametype="primary name"> <namevalue> <firstname>34463firstname</firstname> <surname>34463surname</surname>

web services - HTTP GET or POST for this? -

i writing restful api specification , there's api needs bunch of input data query , return results. behaves because you're asking information, because need provide bunch of request data, seems should post. any thoughts? thanks! if want send form use post . may easier handle in eventual http clients. i use get if want keep query parameters in url, copied , used somewhere else , executed same result.

c# - How to do RegAsm so that it cover 32-bit and 64-bit? -

i have dll file prepared c# , system windows 7 64-bit. when apply regasm not adding registry 64-bit path adding 32-bit path. "c:\windows\microsoft.net\framework64\v4.0.30319\regasm.exe" /register /codebase "c:\o.dll" then if check guid in regedit.exe see have in 32-bit registry path: hkey_classes_root\clsid\{... guid found here ....} instead of hkey_classes_root\wow6432node\clsid\{... not found guid ...} as result have other issues this. can please suggest going on , why not making 32-bit , 64-bit registry entries?" you have backwards. wow6432node 32-bit specific data goes. use 32-bit regasm (from framework directory, not framework64 directory) have component registered in wow6432node.

Multiple checkbox function PHP & Mysql -

i'm beginner in both php & mysql , 've been working multiple checkboxes function days. @ first nothing seem to work nonetheless, has given result can't seem create table out of it and here php page: <?php if(isset($_request['submit'])) { $str = ' 1=1 '; if( count($_post['field']) > 0 ) { $field = implode(',',$_post['field']); $str.= ' , company_field '.$field.''; } if( count($_post['size']) > 0 ) { $size = implode(',',$_post['size']); $str.= ' , company_size '.$size.''; } $run = "select * company 1=1 , company_field '$field' , company_size '$size'"; echo $run; $result = mysql_query($run); while ($row = mysql_fetch_array($result)){ $company_name = $row[0]; $company_field = $row[1]; $company_size = $row[2];

Optional chaining and Array in swift -

let's take these 2 simple classes show problem: class object{ var name:string? // keep simple... , useless } class testclass { var objects:anyobject[]? func initializeobjects (){ objects?.insert(object(), atindex:0) // error objects?.insert(object(), atindex:1) // error objects?.insert(object(), atindex:2) // error } } with implementation 3 errors could not find member 'insert' try add object objects array. now, if remove optional objects definition , optional chain in initializeobjects works no problem (here working code) class object{ var name:string? } class testclass { var objects:anyobject[] = anyobject[]() // remove optional , initialize empty array func initializeobjects (){ objects.insert(object(), atindex:0) // remove opt chaining objects.insert(object(), atindex:1) // remove opt chaining objects.insert(object(), atindex:2) // remove opt chaining } } i can&

Uploading Video on Amazon S3 - "too much to process! with exit code 137" -

i trying upload video file amazon bucket. below code using so. followed example on amazon documentation. it starts , says "too process!" , exits 137. why failing upload? size of video 80 mb. string existingbucketname = "***mybucket***"; string keyname ="***myvideo.mov***"; string filepath = "***/users/myhomedir/desktop/myvideo.mov***"; transfermanager tm = new transfermanager(new profilecredentialsprovider()); system.out.println("hello"); // transfermanager processes transfers asynchronously, // call return immediately. upload upload = tm.upload( existingbucketname, keyname, new file(filepath)); system.out.println("hello2"); try { // or can block , wait upload finish upload.waitforcompletion(); system.out.println("upload complete."); } catch (amazonclientexception amazonclientexception) { system.out.println("unable