Posts

Showing posts from September, 2013

php - CodeIgniter - MySql timestamp/datetime keep giving me zeros when inserting -

i current using codeigniter 2.2.2 , have following code inside modal: $this->createdate = time(); $this->db->insert('somedb_table', $this); where createdate type timestamp (i tried datetime). giving me zeros when inserting inside db. there other way around this? such: 0000-00-00 00:00:00 try this(array input method) $my_array = array( 'database_field' => $this->input->post('input_form_field'), 'time_stamp' => date('y-m-d h:i:s'), ); $this->db->insert('somedb_table', $my_array);

javascript - How to disable or uncheck a checkbox in ng-grid? -

i need disable or uncheck checkbox depending on condition. try solution how disallow selection beforeselectionchange select chekbox selection in ng-grid , row (the data) it's selected. $scope.gridqueryreporte = { data: 'datapaginadaintegrantes', columndefs: [{ field: 'numerosolicitud', displayname: 'label_id_solicitud', headercelltemplate: loadheadergrid(), celltemplate: loadcellgrid() }, { field: 'tiponumidsolicitud', displayname: 'tipo y no. id solicitud', headercelltemplate: loadheadergrid(), celltemplate: loadcellgrid() }, { field: 'nombresolicitud', displayname: 'nombre solicitud', headercelltemplate: loadheadergrid(), celltemplate: loadcellgrid() }, { field: 'tiponumidintegrante', displayname: 'tipo y no. id integrante', headercelltemplate: loadheadergrid(), celltemplate: loadcellgrid() }, { field: 'nombreintegrante', d...

Ending a Game Based on a Boolean not running any more code afterwards In Java -

i'm making text based version of game "are smarter 5th grader. it's not quite same, asked first grade question, , if miss it, 1 more redemption 1st grade question, , if miss 1 game over, if right can move on 2nd grade question(s). public boolean correct; public void firstsection() { scanner scan = new scanner(system.in); main man = new main(); system.out.print("the first category 1st grade math. here question... \n 5 * 2 + 4 / 2 ?" + " \n a. 18 \n b. 15 \n c. 12 \n d. 20"); string answer; answer = scan.nextline(); if(answer.equalsignorecase("c")) { system.out.print("congrtulations smarter 1st grader!"); correct = true; } else { system.out.print("you missed first question, have 1 chance redeem yourself. here 1st" + " grade social studies question... \n name of ship pilgrims sailed america named?" + " ...

r - How much data can be loaded in a shiny app without causing stability issues? -

right i'm loading 100mb of data in global.r file of shiny app. while app runs fine locally, shiny server regularly crashes. culprit following error (after waiting 30 seconds app load): an error has occurred application failed start. application took long respond. i've tried every possible setting app_init_timeout , including setting -1 , still no luck. i'm wondering if there upper bound amount of data can loaded in shiny server session. here's shiny server config file looks like: # instruct shiny server run applications user "shiny" run_as shiny; # define server listens on port 3838 server { listen 3838; # define location @ base url location / { # host directory of shiny apps stored in directory site_dir /vagrant/sites/; # log shiny output files in directory log_dir /var/log/shiny-server; # when user visits base url rather particular application, # index of applications available in directory shown. directory_index on; } } you...

Transform Data in R -

i have uploaded data set r. dataset has 2 columns user_id merchant_id 514729 14852,16695 1240327 23590 7457 211 359027 2483 463149 5802 514730 5460,1896 41953 7183,147105 927805 304,3909,4151,32,3,39171 as can see user ids associated multiple merchants. looking transform data in such way have following schema user id merchantid1 merchantid2 merchantid3 merchantid 4 123445 0 1 0 1 123453 1 0 0 0 basically want create matrix of userid , merchant ids 1 or 0 based on if user_id has merchant_id or not. any suggestions/help on how can accomplish this? i looking use build recommendation system. great. my interpretation after following: library(splitstackshape) csplit_e(mydf, "merchant_id", ",", type = "character", fill = 0) ## user_id merchant_id merchant_id_147105 merchant_id_14852 merchant_id_16695 ## 1 514729 14852,16695 0 1 ...

python - PyJWT, Expecting a PEM-formatted key -

i have copy pasted code layer: https://github.com/layerhq/support/blob/master/identity-services-samples/python/controller.py i have been told 2 other people ran on mac machines. using windows 7, , getting typeerror: expecting pem-formatted key when running code: #read rsa key root = os.path.dirname("__file__") open(os.path.join(root, rsa_key_path), 'r') rsa_priv_file: #not sure adding utf-8 @ priv_rsakey = rsa.importkey(rsa_priv_file.read()) #create identity token #make sure have pyjwt , pycrypto libraries installed , imported identitytoken = jwt.encode( payload={ "iss": provider_id, # string - provider id found in layer dashboard "prn": user_id, # string - provider's internal id authenticating user "iat": datetime.datetime.now(), # integer - time of token issuance in rfc 3339 seconds "exp": datetime.datetime.utcnow() + ...

How to get webcam video feed in a firefox addon? -

i developing addon requirement capture webcam video. did testing , noticed navigator.mediadevices.getusermedia() available within panel , hence have written following content script panel webcam video feed addon. var mediastream; var mediarecorder; // instance of mediadevices object use. navigator.mediadevices = navigator.mediadevices || ((navigator.mozgetusermedia || navigator.webkitgetusermedia) ? { getusermedia: function(c) { return new promise(function(y, n) { (navigator.mozgetusermedia || navigator.webkitgetusermedia).call(navigator, c, y, n); }); } } : null); function startvideocapture(width, height, framerate) { // check if browser supports video recording if (!navigator.mediadevices) { return; } // lets initialize video settings use our video recording session var constraints = { audio: false, video: { width: 640, height: 320, framerate: 25 } }; // make request start video capture navigator.mediadevices.getusermedia(const...

c# - Visio Document Variable -

i store variable data inside of visio file similar how can in word file, unable find similar visio. word example be: worddocument.variables("myvar").value = "myvariable"; alternatively, can store file (xml instance) inside of visio file, read , write file @ run time? first option voiced @jon fournier. documentsheet visio way store document-specific values. check out article, gives more details: http://visualsignals.typepad.co.uk/vislog/2011/11/shapes-with-global-values.html the second option document.solutionxmlelement, allows store arbitrary xml fragment in visio file document. https://msdn.microsoft.com/en-us/library/office/aa218416.aspx third option (note bit archaic) create hidden master , store document data in there (in it's shapesheet). note visio not support "customdocumentproperties" way other office application do. see more information here: https://social.technet.microsoft.com/forums/office/en-us/85fbc601-1612-4e63-91f...

get - Is there a way to escape all the special characters in a url string parameter? -

i need users able pass file path parameter of url (the file not uploaded , local file path used security reasons). it's difficult them go , change backslashes "%5". wondering if there way force encoding of part of url. example simple putting in double quotes, doesn't work... http://example.com/"c:\user\somone\somefile.txt"/dosomething i ended using pattern matching of rest routes @ server level. this: /example.com/*path/dosomething so match path slashes/backslashes. @ last decoding of url rid of escaped characters passed browser chars space. java.net.urldecoder.decode(path, "utf-8")

Struggling to grasp Recursion in JavaScript -

right i'm going through codecademy's recursion track , i'm confused how interpret correct code. // create empty array called "stack" var stack = [] // here our recursive function function power(base, exponent) { // base case if ( exponent === 0 ) { return 1; } // recursive case else { stack[exponent-1] = base * power(base, exponent - 1); //confused start of line return stack[exponent-1]; } } power(3,3) console.log(stack) // [3,9,27] if exponent-1 becomes 2 1 0, why 3 become element @ 0th position in array rather @ 2nd position (and on) ? i'd appreciate help. on first pass, exponent 3, store value @ stack[2]. value not calculated until recursive call has completed power(3,2)...power(3, 1). so assignment stack[3-1] preceded 1 stack [3-2], in turn preceded 1 stack[3-2]

powershell - Rename multiple nics using a CSV file -

i cannot seem figure array/loop combination out. looking run script obtain active nics , rename them based on csv file. afterwards, create nic team , utilize csv file again setup static networking information. i obtain active nics using: $adapter = get-netadapter | {$_.status -eq "up"} the csv file headings in following form: host newname ipaddress subnet gateway dns the newname column has value of admin1a;admin1b . here example works produces errors: foreach ($entry in $dc1_nics) { $newname = $entry.newname.split(";") foreach ($item in $newname) { foreach ($nic in $adapter) { rename-netadapter -name $nic.name -newname $item } } } so, have 2 names can split, admin1a , admin1b cannot seem nics named appropriately, either 1 nic gets renamed or both , there additional errors. the problem nested foreach loops, because takes first name, each nic tries name nic name, , moves second nam...

python - Is there a pandas function to display the first/last n columns, as in .head() & .tail()? -

i love using .head() , .tail() functions in pandas circumstantially display amount of rows (sometimes want less, want more!). there way columns of dataframe? yes, know can change display options, in: pd.set_option('display.max_columns', 20) but clunky keep having change on-the-fly, , anyway, replace .head() functionality, not .tail() functionality. i know done using accessor: yourdf.iloc[:,:20] emulate .head(20) , yourdf.iloc[:,-20:] emulate .tail(20). it may short amount of code, it's not intuitive nor swift when use .head(). does such command exist? couldn't find one! no, such methods not supplied pandas, easy make these methods yourself: import pandas pd def front(self, n): return self.iloc[:, :n] def back(self, n): return self.iloc[:, -n:] pd.dataframe.front = front pd.dataframe.back = df = pd.dataframe(np.random.randint(10, size=(4,10))) so all dataframe possess these methods: in [272]: df.front(4) out[272]: 0 1 ...

winapi - Disable application taskbar icon's context menu in Windows 8.0 and 8.1 -

Image
in windows 7, 8 , 8.1, when user right-clicks on application's taskbar icon, context menu appears. furthermore, user can right-click on application's name again (from context menu) , context menu appears, shown in image windows explorer: is there possible way (through winapi or registry or gpo) disable items in first context menu except "close window" in win 8 , 8.1? know achieved in windows 7 setting prevent pinning on application window doesn't work in windows 8 , 8.1... if not, possible show "close window" , application launcher icon in context menu in windows 8/8.1 without allowing user right-click on application's name , display properties context menu? i found registry value job well: noviewcontextmenu: https://technet.microsoft.com/en-us/library/cc960925.aspx

html5 - Keeping data in the data field Jquery -

i have php page input fields. gonna put values in these input fields. need keep values in inputs fields when go other php page, need values. how can do? jquery isn't made holding values of form fields page-to-page. that's job php. if data form needs sent php page, i'd imagine sending data via post variables , dealing them within requested php page appropriate.

r - error with lapply on anonymous ggplot function -

i'm trying use lapply on ggplot anonymous function if (inputmethodp=="withinfile") { par(mfrow=c(5,listportions)) plotlist<-lapply(rangestatresultp, function(listpart) { ggplot(matrixpart, aes(x = factor(var2), y=value)) + geom_violin()+ ggtitle(names(listpart)+xlab(listnum)+ylab("coverage")+ stat_summary(fun.y = median, geom = "point", position = position_dodge(width = .9), size = 6, shape = 4, show_guide = f) }) } when ever insert chunk of code script gives me error error: unexpected '}' in: " size = 6, shape = 4, show_guide = f) }" is syntax wrong? can't seem hunt down whatever stray { causing this. ...

sql server - Paramaterized SQL Query C# -

this question has answer here: how create parameterized sql query? why should i? 5 answers this simple query have written. best way paramaterize prevent sql injection? string selectquery = "select [id] [mydb].[dbo].[mytable] [myname] = '" + user.globalusername + "'"; you can use @ define parameter, this: string selectquery = "select [id] [mydb].[dbo].[mytable] [myname] = @username;"; then can define parameter using command.parameters function, this: cmd.parameters.add("@username", sqldbtype.varchar); cmd.parameters["@username"].value = user.globalusername; or this: cmd.parameters.addwithvalue("@username", user.globalusername);

windows - Python: Finding if a process has file handle to known file -

initial problem: in python , on windows, use win32file.readdirectorychangesw find files have changed. trying find out what process modified them/has handle opened them. of following work: pid, name, full path, etc. that's top-down approach. i've got half way bottom-up approach using wmi process list. process list found process i'm looking , tried use psutil.open_files() find file handles had opened, doesn't return relevant files i'm looking for. (i.e. winword.exe doesn't have "asdf.docx" in list returned) how can find process has lock on file found modified readdirectorychangesw?

Why session is not destroyed, after i destroy it in my logout.php page? -

i have started session (session_start()) in file included in pages. link logout.php in file, ll post code included file later, code logout.php page. after logout, ok, if click more 2-3 times on admin button (which should active if $_session['user1'] , $_session['pass'] r correct) proceed admin.php page (after destroyed session o.o); part of included file pages: <?php session_start(); if ((!isset($_session['user1']))&&(!isset($_session['pass1']))) { echo "<li><a href='login.php'>admin</a></li>"; } else { echo "<li><a href='admin.php'>admin</a></li>"; }; ?> logout page: <?php session_start(); unset ($_session['user1'],$k); unset ($_session['pass'],$p); session_destroy(); header('location:naslovna.php'); exit(); ?> as per documentation : session_destroy() des...

Patterns for developing and merging teamcity build configurations -

during normal development of coded or configured project involves merging changes of sort. the same holds true teamcity build configurations themselves. i'm failing see way in teamcity. far i've found couple of primary ways move developed build configuration production usage. these assume have build configuration in use production... i.e. it's not being actively modified or configured. make copy of build configuration a. we'll call copy build configuration b. make changes configuration b , test them. now, there 2 ways configuration a. a. delete build configuration , move configuration b in. doing remove history of configuration a. or b. manually, hand, make changed needed configuration a. this seems error prone , lends great deal of human error. if there better way this, or has thoughts, please let me know. it difficult test changes in isolation, when use templates lot , changing template affect number of builds. in scenario...

python - Pandas value_counts() for loop fails as lambda -

i have dataframe of 3 variables , want create dictionary of relative count of each label each variable. i created forloop outputs want, lambda produces wierd results. here data: in [3]: import pandas pd raw_data = { 'category1': ['red', 'red', 'red', 'green'], 'category2': ['plane', 'plane', 'plane', 'car'], 'category3': ['orange', 'orange', 'orange', 'banana'], } df = pd.dataframe(raw_data) df out[3]: category1 category2 category3 0 red plane orange 1 red plane orange 2 red plane orange 3 green car banana this loop produces exact output want: in [4]: forloop = {} column in df: forloop[column] = df[column].value_counts(normalize=true).to_dict() forloop out[4]: {'category1': {'green': 0.25, 'red': 0.75}, 'category2': {'car': 0.25, 'plane': 0.75}, 'category3...

Sbt 0.13 ScriptEngine is Null for getEngineByName(“scala”) -

i have problem in using scriptengine sbt 0.13.8 build.sbt fork in run := true scalaversion := "2.11.6" librarydependencies ++= seq( "org.scala-lang" % "scala-compiler" % "2.11.6" ) useconfig.scala object useconfig { def main(args: array[string]) = { import javax.script.scriptenginemanager val e = new scriptenginemanager(null).getenginebyname("scala") println(e) } } and prints null. when run similar code in scala 2.11.6 console scala engine found successfully. p.s. there other ways compile dynamically scala code under sbt?

python - Django incorrectly expecting id column -

i'm working existing sql database in django. these tables reason never given primary keys i'm going through , assigning them ones. in 1 of these models, changed existing unique index primary index using primary_key = true . ran ./manage.py makemigrations (app_name); ./manage.py migrate . came across error: (1091, "can't drop 'id'; check column/key exists") . seems though django assumed there id field model when there wasn't because able use phpmyadmin make id field, , when re-ran migration succeeded. while able fix problem doubt best way go it. correct way deal problem? you fake migration including removing "id" field using --fake option when migrating, django thinks had deleted id field when never existed.

Documenting library/mixin/behaviors elements in Polymer 1.0 -

i had polymer 0.5 element used library injected other elements using mixins. formatted followed , of jsdoc notation showed in index.html : <polymer-element name="easy-search-lib" attributes=""> <template> <content></content> </template> <script> var easysearch = { /** * returns whether given domain matches search. * * @method matches * @param {string} query string being searched for. * @param {string} text text being searched within. * @return {boolean} returns if there match. */ matches: function(query, text){ query = this.getquery(query); return query.test(text); } //... }; polymer(polymer.mixin({ /** * convenience function testing, binds easysearch polymer element. * * @attribute easysearch * @type object */ easysearch: easysearch }, easysearch)); ...

Cannot get php pthreads to work on centos -

i'm struggling php pthreads working on linux centos php program errors warning: php startup: unable load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20121212/pthreads.so' - /usr/local/lib/php/extensions/no-debug-non-zts-20121212/pthreads.so: undefined symbol: core_globals_id in unknown on line 0 , fatal error: class 'thread' not found in... running "ls /usr/local/lib/php/extensions/no-debug-non-zts-20121212/" shows pthreads.so there: apc.so fileinfo.so json.so mysqli.so opcache.so pdo_sqlite.so sqlite3.so xmlwriter.so curl.so gd.so mapi.so mysql.so pdo_mysql.so phar.so wddx.so xsl.so dom.so imap.so mbstring.so opcache.a pdo.so pthreads.so xmlreader.so zip.so i ran script below configure php when run php -m "pthreads" not appear in list, , on php -i see thread safety => disabled. unusually when @ phpinfo() via browser see php version 5.5.8 , thread s...

spring - Transactional annotation does not save on exit -

i have configured spring jpa annotation driven. expect following code persist changes database upon method exist. @transactional public foo changevalue(int id){ final foo foo = foorepository.findone(id); if(foo != null){ foo.setvalue("new value"); //foorepository.save(foo); } } foorepository jparepository , foo object getting fetched managed. based on read @transactional i expect without foorepository.save(foo) call changes in foo's value column in database persisted upon method exist. however, happens if uncomment call foorepository.save(foo) no exceptions thrown , configuration jpa datasource below. <bean id="entitymanagerfactory" class="org.springframework.orm.jpa.localcontainerentitymanagerfactorybean"> ... <bean id="transactionmanager" class="org.springframework.orm.jpa.jpatransactionmanager" p:entitymanagerfactory-ref="entitymanagerfactory" /> ...

jquery - Bootstrap checkbox won't fire the change event -

so, have checkbox made using bootstrap methodology. trying show or hide divs depending on whether or not checkbox checked. have following html: <div class="col-lg-12"> <div class="checkbox" id="partner-div"> <label> <input type="checkbox" id="chkpartner" /> check here if acelity partner or representative submitting video on behalf of else. </label> </div> </div> <div class="form-group acelity-partner" style="display:none"> <div class="col-lg-12"> <label for="txtrepfirstname">representative's first name</label> <input type="text" class="form-control" id="txtrepfirstname" placeholder="representative...

Erlang based chat (load balancing and notifications distribution) -

we going develop backend our messenger, have 1 idea want describe here, maybe can give me advice. 1) idea: nginx - redirects request random node (round robin) -> erlang cluster - redirects actual node (we choose node minimum number of processes) -> handshake -> upgrade websocket. every node in cluster has ets table contains number of processes every node (fields - node, num_processes). every node, every 5 secs sends number of processes nodes in cluster. so don't need have master node, because every node can load balancing. 2) additional question: is idea register user's active websocket connections (pids) globally gproc? need list every user send notifications through ws enduser. 1) yep - scheme. improvement can make increment load of remote node every time balance load node. keeping estimate remote node load , stops sending load 1 node 5 seconds @ time. every time receive broadcast node, overwrite local estimate - fix missing updates , ensure ...

java - Spring mvc annotation, can't find jsp page -

mvc-dispatcher-servlet.xml : <context:component-scan base-package="com.springapp.mvc" /> <mvc:annotation-driven /> <bean name="viewresolver"class="org.springframework.web.servlet.view.internalresourceviewresolver"> <property name="prefix" value="/web-inf/pages/"/> <property name="suffix" value=".jsp"/> </bean> after adding in file, jetty throws error: *.jsp not found. if remove annotation-driven here, works fine. basic servelet. controller code : @requestmapping(value = "/v1/deliveryeta", method = requestmethod.get) public string getdeliveryeta(model model) { model.addattribute("deliveryeta",new deliveryeta()); return "getdeliveryeta"; } and getdeliveryeta.jsp : <%@ taglib prefix="th" uri="http://www.springframework.org/tags/form" %> <%@ taglib prefix="form" uri="http://...

Magento: Login and redirect to account page from outside magento -

i using below code login , redirect account page: <?php include('store/app/mage.php'); mage::app(); if($_post && $_post['login']['username'] && $_post['login']['password']){ $email = $_post['login']['username']; $password = $_post['login']['password']; $session = mage::getsingleton('customer/session'); try { $log = $session->login($email, $password); $session->setcustomerasloggedin($session->getcustomer()); $customer_id = $session->getcustomerid(); $send_data["success"] = true; $send_data["message"] = "login success"; $send_data["customer_id"] = $customer_id; mage::getsingleton('customer/session')->loginbyid($customer_id); mage_core_model_session_abstract_varien::start(); }catch (exception $e...

Azure Search Service a field that has . or # not decoding no results -

we using .net library azure search, have built index , stored data in index. 1 of our fields called tags collection of strings , marked searchable. put values in field such c# .net. the problem when searching search service not hit on c#, on c, nor hit on .net on net. can see thru fiddler search term encoding # , ., doesn't seem it's getting decoded on azure side. the behavior you're seeing result tokenization performed standard analyzer used azure search. default breaks on many punctuation characters # , . (you can details of text analysis in azure search here ). we're looking adding support custom analyzers let exclude characters such # , . word-breaking, still in planning stages. in meantime, workaround suggest encoding these characters in application before indexing , querying (e.g. -- c# -> csharp, .net -> dotnet).

freepascal - Ignoring comment in Pascal -

i have made following program: program test; uses crt; var input: text; line: string; charcount: integer; procedure findidentifiers(line: string); var word: string; wordfound: boolean; numberfound: boolean; begin word := ''; wordfound := false; numberfound := false; charcount := 1 length(line) begin if line[charcount] in [' ', '.', ',', '+', '-', '''', '*', '=', '!', '?', ':', ';', '(', ')', '/', '\', '[', ']', '^', '>', '<'] begin if wordfound begin if not numberfound begin writeln(word); end; wordfound := false; numberfound := false; word := ''; end; end else begin if not wordfound begin if line[charcount] in ['0' .. '9...

python - Kivy - using .kv -

i trying transfer widget creation .kv instead of in main.py. how can still reference on_press commands? painter child widget , contains function want call, unsure how can reference painter.acceptshape .kv. class testingapp(app): def build(self): parent = floatlayout() keepbtn = button(pos= (10,10),text='accept shape',size_hint=(.25, .15),font_size=14, color=(0.960784, 1, 0.980392,1), background_normal = '',\ background_color= ( 0.0980392, 0.0980392, 0.439216,1), font_name='exo2-bold.otf') restartbtn = button(text='restart',size_hint=(.2, .15),font_size=14, color=(0.960784, 1, 0.980392,1), background_normal = '',\ background_color= (0.0980392, 0.0980392, 0.439216,1), font_name='exo2-bold.otf') renderbtn = button(text = "render shape", size_hint=(.2, .15),font_size=14, color=(0.960784, 1, 0.980392,1), background_normal = '',\ background_color= ( 0.0980392, 0.0980392, 0.4...

intel - strcmp and strcmp_sse functions in libc -

i've seen in libc.so actual type of strcmp_sse call decided function strcmp itself. here code: strcmp: .text:000000000007b9f0 cmp cs:__cpu_features.kind, 0 .text:000000000007b9f7 jnz short loc_7b9fe .text:000000000007b9f9 call __init_cpu_features .text:000000000007b9fe .text:000000000007b9fe loc_7b9fe: ; code xref: .text:000000000007b9f7j .text:000000000007b9fe lea rax, __strcmp_sse2_unaligned .text:000000000007ba05 test cs:__cpu_features.cpuid._eax, 10h .text:000000000007ba0f jnz short locret_7ba2b .text:000000000007ba11 lea rax, __strcmp_ssse3 .text:000000000007ba18 test cs:__cpu_features.cpuid._ecx, 200h .text:000000000007ba22 jnz short locret_7ba2b .text:000000000007ba24 lea rax, __strcmp_sse2 .text:000000000007ba2b .text:000000...

cordova - what are benefits of meteor's phonegap wrapper vs a native app with a webview? -

building phonegap can flaky furstrating process. actual benefits of using phonegap layers vs. plain native app opens webview? i understand mdg's cordova build added caching on parts of app js code since new meteor release updates whole single js file each time, wouldn't of benefit. maybe image caching? local webserver anything? if using native apis js cordova bridge of use. but using plain native app, access build stability, , it's trivial open webview. js bridge opens access native apis too. there various phonegap plugins, of these wrappers around native sdks anyway, introducing nothing more leaky problems (eg getting facebook login work phonegap , meteor) i've built native android wrapper ~1mb, uses latest chrome webview, , can extended native features easily. i'd know more benefits of using phonegap are, since mdg put time it. update: meteor forums discussion https://forums.meteor.com/t/cordova-benefits-vs-custom-native-wrapper/5356 met...

javascript - How to expand/collapse (+/-) for a nested dynamic list using jquery -

i have tried toggle function think selecting proper list having problem. var json ={"asia": [{"regionlist": [{"regionname": "eastern asia","countrylist": [{"countryname": "china","subcountrylist": [{"subcountryname": "southern china"},{"subcountryname": "eastern china"}]},{"countryname": "hong kong"}]},{"regionname": "southern asia","countrylist": [{"countryname": "india"},{"countryname": "pakistan"}]}]}]}; var html = ''; $.each(json, function(i1, object) { html += '<li><input type="checkbox" /><b class=' + i1 + ' ><a name="' + i1 + '" >' + i1 + '</a></b>'; $.each(object, function(i2, continent) { html += '<ul>'; $.each(continent.regionlist, fu...

java - How to generate dynamically many JTextfield/JButton/... with different id using a loop? -

Image
i'm working right on project java allowing manager create todo list , employee view different todo, process , modify in exemple adding comment. the employee's interface should consist of: a lot of jtabbedpane dynamically generated depending on number of todo in database. each jtabbedpane must contain information of todo ( title, jtextfield add comment, jtextbox mark todo done , jbutton save our changes. my problem when generate jtextfield, etc.. in different jtabbedpane have same id because use while loop follows: private void init_employee() { try { /* create frame */ settitle("suptodo employee"); setsize(800, 800); /* new panel*/ jpanel toppanel = new jpanel(); toppanel.setlayout( new borderlayout() ); getcontentpane().add(toppanel); tabbedpane = new jtabbedpane(); /* select in data base *...

jquery - knockout how to get $parent of $parent -

<div id="root" data-bind="with: $data.building"> <div data-bind="foreach: $data.offices"> <div data-bind="foreach: $data.desks"> <div data-bind="foreach: $data.legs"> <button class="btndestroydeskleg"> destroy</button> </div> </div> </div> </div> <script> $("#root").on('click', '.btndestroydeskleg', function () { var context = ko.contextfor(this), office = ** ? **, desk = context.$parent, leg = context.$data; }); </script> how can $parent of $parent? in other word, should replace "** ? **" office? you can use $parents array described in knockout documentation . to parent context can use $parents[0] to grandparent context can use $parents[1] so in cas...

Creating a real-time chat with Python and websocket -

i'm writing python real-time chat feature embedded in web app. i'm little bit confused on real time implementation. need push real time message different users. i plan use websocket i'm not quite sure how save sockets array once user send message server, server can find related socket , push message. so idea this? or what's common way implement real time chat feature? thanks in advance. you need use websocket aware web server, tornado handle websocket traffic. multiplex chat messages between different chats , users, there solutions redis , zeromq can use message multiplexing. however, sounds have 0 experience , starting point, starting working example better approach. please study existing real-time chat implementations python: https://github.com/heroku-examples/python-websockets-chat https://github.com/nellessen/tornado-redis-chat https://github.com/tornadoweb/tornado/blob/master/demos/websocket/chatdemo.py http://ferretfarmer.net/2013/09/...

Syncing script makes gui slow in IOS app swift -

Image
i've got method sync app online api. when running sync script reponses of app delayed. tried using: dispatch_async(dispatch_get_global_queue(dispatch_queue_priority_background, 0), { self.synceverything() } this doesn't has effect on speed. tell me right approach problem? edit i changed code, syncing script using different context context of main thread. when syncing complete, merge contexts. still syncing slowing down gui. below cpu activity when syncing, mean running on main thread? in of classes used in "synceverything()" uikit imported, cause of delay?

c# - Is it possible to fill a normal array with values from the sql server? -

i want create method returns array of class know how arraylist need fill 'normal' array[]. i'm doing arraylist public arraylist getlistproductfamily() { arraylist arrayproductfamily = new arraylist(); iconnection conn = connutil.getconnection(); string query = get_query; productfamily productfamily = new productfamily(); try { conn.executereader(query); if (conn.datareader.read()) { productfamily.cidproductfamily = db.loadstring(conn.datareader, "cidproductfamily"); productfamily.cproductfamily = db.loadstring(conn.datareader, "cproductfamily"); productfamily.lactive = convert.toint32(db.loadint(conn.datareader, "lactive")); arrayproductfamily.add(productfamily); } } catch (exception ex) { logger.error("error", ex); } return arrayproductfamily; } public productfamily[] getl...

rest - Server internal error with post request in api restful -

i'm having problems post requests in api restful i'm testing , don't see error. here i've api import javax.ws.rs.consumes; import javax.ws.rs.get; import javax.ws.rs.post; import javax.ws.rs.path; import test.api.models.test; import test.api.mediatype; @path("/test") public class testresource { @get public string getsomething(){ return "ok get"; } @post @consumes(mediatype.test) public string postsomething(test test){ system.out.println("got: " + test); return "ok post"; } } the problem when request localhost:8080/test-api/test postman application, "ok get". if post request 500 server error. i'm setting correctly content-type header field. error is: "message": "http 500 internal server error", "status": 500 and how i'm sending data: { "a": "one", "b": "two" } i th...

jquery - Can I nest whens? -

working in sharepoint, trying retrieve , process data multiple lists. return second list getting paged, breaks ordering (as far can tell). so, thought literally nest new 'when' second list access must loop gather data returned. generic 'syntax error'. have no clue else try. this trying (that syntax error): $.when( retrieveproductdata()) .then( $.when( retrievemilestonedata("https://<myemployersproprietaryurl>")) .then( displayreportdata) .then(function() { $("#processingdiv").hide(); }); ); anybody have suggestions? i'm stuck... thanks. more info: both retrieveproductdata , retrievemilestonedata make $.getjson calls proprietary rest urls. i'm passing url retrievemilestonedata, can grab '__next' url returned results, , recurse retrievemilestonedata '__next' url parameter. displayreportdata needs information both rpd , rmd functions work correctly... you ...

amazon web services - AWS ELB Server certificate trust -

background: i have iis application running behind aws elb. ssl certificate presented server , not elb [tcp pass threw]. question: does elb have trust certificate presented iis? the ssl certificate presented server , not elb [tcp pass threw]. if using tcp pass through, no, doesn't matter certificate looks like. elb forwarding raw tcp data. when using tcp->tcp elb doesn't know traffic ssl.

ms word - How to detect when a user attempts to modify a protected document MSWord 2003 -

i attempting create document template in msword 2003 (actually 2007, in 2003 format), running on win7 machine, user create document, user approve document, can print document. final document read-only protected through word's protection feature. i've got of down in vba code well, it's relatively straightforward. i able add when user attempts modify protected final document vba code detect , create new document new revision level. can't seem figure out code needed trap event user attempts modify read-only document. know if possible? if not, ill add second button allow creation of new revision of document. thanks in advance. i can't give direct answer without seeing code... give user dialog box upon opening options either make new save or close. example code yes/no dialog box , if statement: dim yesornoanswertomessagebox string dim questiontomessagebox string questiontomessagebox = "are expert of vba?" yesornoanswertomessagebox...

php - Weird Unicode Error. - Zen Cart software -

so, inherited project , i'm coming across weird unicode error website rendering:  now, when use developer tool kit inside zen cart admin panel find error is, says location is: line #0 : <?php , how happen? if knew error being produced post code snippet but, have no idea. suggestions? ivan gabriele correct referred shadow character: what's  sign @ beginning of source file? the why resolve issue in visual studio posted here: utf-8 without bom

php - Integrate Facebook login and register -

the site has php login , register, has have facebook login , register too. making them separate - can that, making them combined - i'm confused it. i mean, if click login , facebook, facebook email registred in system basic system(not facebook one), person should error message, right? can give me advice how integrate facebook login basic php login, don't mess code or database?

VIM Convert Text to URL with Search/Replace -

i have document contains long filenames, followed hyphen, followed description of contents of file. files pdfs. converting document page on our website, has filename, should link file, followed description of file contents. i'm versed in basics of vim, advanced search/replace i'm lacking in. i'd convert each filename link filename. example: webadapt_prod_int_10.1_install.iis7.2008r2.pdf - step step instructions installing arcsde 10.1 oracle on ‘test’ environment, including configuration notes. should convert to: <a href="documents/webadapt_prod_int_10.1_install.iis7.2008r2.pdf">webadapt_prod_int_10.1_install.iis7.2008r2.pdf</a> - step step instructions installing arcsde 10.1 oracle on ‘test’ environment, including configuration notes. there 30 of these documents, going line-by-line time consuming (though time response i'll have done it). i'd know how next time i'm given big text file needs formatting. thanks in advance! ...

version control - Two parallel independet branches in the same repo in git -

i new git , trying learn new stuff. i want know possible have 2 branches independent of each other (no common ancestor) in same repo. illustrative example: let's imagine have repo stored in git@git.somedomain.com . under ~/git/ have many directories ( mydir1 , mydir2 , mydirn ...) holding code have obtained doing: git clone git@git.somedomain.com:my-repo-1 git clone git@git.somedomain.com:my-repo-2 , on... now want move ~/git/mydir1/scripts ~/scripts/ because want keep scripts separate source code stored in ~/git/mydir1 i go ~/scripts , execute git init create local repo scripts. and there stuck. questions: how push local repo git@git.somedomain.com:my-repo-1 ? how content of ~/scripts (the newly pushed branch) in ~/somescripts on other pc? i apologize beforehand if have abused git terminology, still trying learn branch, remote, origin etc. mean. is possible have 2 branches independent of each other in same repo. in same repo,...

wordpress - Custom Registration -

i need create custom registration flow , bit stuck. the requirements follows: 1 role user (vendor per wc vendors) 3 types of users (wholesale, retail, private) different profile fields each type different registration form each type different profile page (buddypress) each type also i need user sign minimal details force user complete profile in order able use site (sell products). so far have seen many custom form plugins such ninja forms , gravity forms couple of front end form plugins such wp user frontend , profile builder don't know 1 choose!!! any help, advice, support appreciated. thanks in advance. eyal

Wordpress setting multiple object terms -

i'm trying figure out how set multiple value wp_set_object_terms() wordpress function. i tried use array: $array = array(102, 59); wp_set_object_terms ($property_id, $array, 'property-city'); but sets last value "59". you might want set append parameter true, if want add terms. wp_set_object_terms( $object_id, $terms, $taxonomy, $append ); refer to: https://codex.wordpress.org/function_reference/wp_set_object_terms

android - Removed permissions still show up in Play Store -

i pushed beta version google play accidentally added more permissions compared version that's current in production. before pushing final new version production via staged rollout, removed permissions, despite that, users still complaining new permissions when received update on play store. why new permissions still visible? removed apk beta channel, neither of production apks (both old one, , new 1 in staged rollout) have new permissions. see new permissions in play store listing. by using newer sdk not changing targetsdkversion of imported modules, automatically inherited implicit permissions. for one, there 1 library targetsdkversion of 3 - automatically add read_phone_state, documented in this answer , , the official docs . this can seen looking @ manifest merger log in build/output/logs/manifest-merger-release-report.txt: android:uses-permission#android.permission.read_phone_state implied androidmanifest.xml:2:1 reason: com.foo.library has targetsdkversi...