Posts

Showing posts from March, 2014

Python Set Comprehensions -

this question has answer here: set changes element order? 6 answers how return value of set function organized? 2 answers i'm starting out learning python set comprehensions. why { 2**x x in {0,1,2,3,4} } return {8, 1, 2, 4, 16} instead of ordered {1, 2, 4, 8, 16} ? mathematically speaking, sets not have order. when displaying or iterating on set, python needs provide particular order, order arbitrary , not relied on. order is, however, fixed particular set; iterating on same, unmodified set produce same order each time.

c# - EF Codefirst Migrations new database -

i'm confused in situation i've gotten myself into. i've recreated database after issue. when run project, codefirst creates database ef model. site works fine. but come add migration, says i've got explicit migrations pending on database. these pending migrations existing migrations. it appears db has been created recent model. without model/revision data attached. how go populating migration data ef knows db date? i have ask, how did go resolving issue had? idea of migrations can go backwards , forwards through them, allowing revert changes. that said, are. in instance have agree @sq33g , remove existing migrations, , fix current database. haven't provided comprehensive account of problem suggest data elsewhere imported current database if required sql queries.

c# - Converting JSON string to lisp(aml) readable string for evaluation using regular expressions -

i'm trying convert json string stringformat can use evaluate in lisp (aml). i want convert f.eks.: {"id": 1, "name": "foo", "price": 123, "tags": ["bar","eek"], "stock": {"warehouse": 300, "retail": 20} } to: (json-object (json-object-property "id" <1>) (json-object-property "name" <"foo">) (json-object-property "price" <123>) (json-object-property "tags"(json-array (list "bar" "eek")) (json-object-property "stock"(json-object (json-object-property "warehouse" <300>) (json-object-property "retail" <20>))))) i'm trying first use c# , regex it, , "translate" lisp/aml. question really: how using regular expression in c#? have tried lot, ends struggling strings inculdes not-word-characters, or few "(". i have ...

Rails 4 assets not found in production (digest path is OK) -

i have problem assets in production. i can't load stylesheets, javascripts or images. when try access something, shows me error - not found when try access -digest, it's ok. i have assets precompiled, deployed via capistrano manifest -> assets_manifest.json thanks log: stylesheet error (stylesheet loaded themes_for_rails gem) when try access /assets/default/stylesheets/application-ec9a310f792c60f2f77810cfcd9b903f.css , ok i, [2013-07-17t14:38:45.120183 #31938] info -- : started "/assets/default/stylesheets/application.css?locale=cs" 90.181.17.25 @ 2013-07-17 14:38:45 +0200 i, [2013-07-17t14:38:45.123007 #31938] info -- : processing themesforrails::assetscontroller#stylesheets css i, [2013-07-17t14:38:45.123429 #31938] info -- : parameters: {"locale"=>"cs", "theme"=>"navarsi", "asset"=>"application"} i, [2013-07-17t14:38:45.124912 #31938] info -- : rendered text template (0....

exception handling - How to determine if the Android Application was force closed? -

i need determine, if application force closed, crashed, or terminated normally. question is: how such thing in android environment. handling exceptions easy, need replace thread.setdefaultexceptionhandler. hard part is: how can distinguish force close shut down "normal" (like press, or home button + lots of time, etc)? the reason is: can synchronize content of local database, server. , have reasons allow operation, in state 1, of main activity, , not in state 2. however, if user finds db related semantic error in program, in state 2 of main activity, or can stuck there. we're prepared incoming call interruption, , other configuration changes, so, if application gets stuck in state 2, force closing app, reopening it, still leave user in stage 2, instead of stage 1. so want leave way, user, after force closed stuck go stage 1, , able synchronize database, majority of or work can saved. unfortunately there no way. when user or system force stops applicatio...

caching - Symfony : Error 500, cache clear on production? -

i can't access module on website, giving me error 500 , don't know why (i don't have access error log). working earlier. i thought have been because of file replaced earlier on ftp server, retransfered previous versions of files related module onto ftp server again. module still giving me error 500 @ moment. i thinking clearing cache on production fix problem. think? i working on copy of original website on wamp , therefore can't delete production cache command line. deleting content of /cache/ folder ftp server same thing? risks represent? clearing cache manually ftp won't harm unless developed specific stores important files in folder.

java.io.IOException: Posted content length of 1130270 exceeds limit of 1048576 -

this question has answer here: form large exception 15 answers while uploading file more 1 mb getting error. java.io.ioexception: posted content length of 1130270 exceeds limit of 1048576 com.oreilly.servlet.multipart.multipartparser.<init>(multipartparser.java:172) com.oreilly.servlet.multipartrequest.<init>(multipartrequest.java:222) com.oreilly.servlet.multipartrequest.<init>(multipartrequest.java:109) com.oreilly.servlet.multipartrequest.<init>(multipartrequest.java:89) org.apache.jsp.jsp.test_jsp._jspservice(test_jsp.java:211) org.apache.jasper.runtime.httpjspbase.service(httpjspbase.java:94) javax.servlet.http.httpservlet.service(httpservlet.java:802) org.apache.jasper.servlet.jspservletwrapper.service(jspservletwrapper.java:324) org.apache.jasper.servlet.jspservlet.servicejspfile(jspservlet.java:292...

memory - oversized python dictionary -

i have large csv files (around 15e6 rows). each row looks : id_user|id_software. my aim build dictionary keys tuples of 2 distincts softwares , values probability these 2 softwares installed on same computer (a computer=id_user). the first step consists in reading csv file , in building dictionary keys user ids , values tuples containing softwares installed on user's computer. the second step created final dictionary reading first one. my problem that, first 5e5 lignes of csv file give birth 1gb dictionary (i use heapy profile me algorithm). any idea me solve issue ? here code : import csv import itertools dict_apparition={} dict_prob_jointe={} nb_user=0 open('discovery_requests_id.csv','ru') f: f=csv.reader(f) f.next() row in f: a=int(row[1]) b=int(row[0]) try: if not in dict_apparition[b]: dict_apparition[b]+=(a,) except: dict_apparition[b]=(a,) nb_user+=1 ...

mysql replication skip statement. is it possible? -

there system row-based replication. yesterday have executed heavy statement on master accidently , found slaves far behind master. have interrupted query on master, still running on slaves. got slaves 15 hours behind master. i have tried step on 1 position resetting slave , increasing master_log_pos, no luck: position wasn't found, because relay log wasn't read further heavy query event. read_master_log_pos == exec_master_log_pos is there way skip heavy query? (i don't care data has changed query) is there way kill query on slave taken relay log? is there way roll slaves in 1 position, remove event master bin-log , resume replication? first explore binary logs on master find sql statement causing issue, using following on master: show binlog events in 'mysql-bin.000xxx' limit 100; then set slave sync statement before that: stop slave; start slave until master_log_file = 'log_name', master_log_pos = log_pos; when want carry on ...

c# - Posting to a friends wall with exception -

the exception getting "the user hasn't authorized application perform action". know published exception there no rules can follow code work. trying post friends wall via api. authenticationresult result = oauthwebsecurity.verifyauthentication(url.action("externallogincallback", new { returnurl = returnurl })); string accesstoken = result.extradata["accesstoken"]; facebookclient client = new facebookclient(accesstoken); dynamic parameters = new expandoobject(); arameters.message = "testing"; i have managed friends facebook ids , facebookfriendid object restest = client.post("/" + facebookfriendid + "/feed", parameters); this throwing exception. need set special options in app allow post friends walls and/or users receving post need accept app first? there other params need send? thanks in advance posting friend's wall has been disabled post friends wall via api generate high levels o...

loops - Java drawimage in gameloop -

i'm trying learn program first game , understand correctly every step make. i'll face double buffering , other things later. i'm trying load image in game loop. have 2 classes. first it's jframe calling start method. wonder if there ugly code, in here (i think so). so, why images not showing up? public class mypanel extends jpanel implements runnable{ //fields public static int width = 1024; public static int height = width / 16 * 9; private bufferedimage bg; private bufferedimage charac; private boolean running; private thread t1; private int startposx = width / 2; private int startposy = height / 2; private int cordx = startposx; private int cordy = startposy; int speed = 50; //methods public synchronized void start (){ running = true; t1 = new thread (this); t1.start(); } public synchronized void stop (){ running = false; try { t1.join(); system.out.println("the game stopped"); } catch (interruptedexcept...

c# - Most efficient way of splitting many strings -

my current project handles large numbers of incoming radio messages (~5m per day) represented strings must divided pre-determined sized chunks, ready storage. for example, message come in following format: mziiiiccssss each different char represents chunk, example holds 5 chunks (m, z, iiii, cc, ssss). an example of message using format be: .91234ne0001 (., 9, 1234, ne, 0001) i've used substring far have been told not efficient regular expressions. if case, how can use regex match @ char positions, instead of semantic pattern? substring faster regex. since trying separate string fixed-size chunks, use substring . chao's comment gave me idea. use string(char[], int, int) constructor, this: string message = ".91234ne0001"; char[] messagearr = message.tochararray(); string chunk1 = new string(messagearr, 0, 1); string chunk2 = new string(messagearr, 1, 1); string chunk3 = new string(messagearr, 2, 4); string chunk4 = new string(message...

"Save" method Windows Powershell (windows 7) returns error -

i trying learn how create desktop shortcut using windows powershell can add script several shortcuts deployment of computers @ company. works until $shortcut.save() command. ps c:\windows\system32> $targetapp = "c:\program files (x86)\mozilla firefox\firefox.exe" ps c:\windows\system32> $wshshell = new-object -comobject wscript.shell ps c:\windows\system32> $shortcut + $wshshell.createshortcut("$home\desktop\firefox.lnk") ps c:\windows\system32> $shortcut.targetpath = $targetapp ps c:\windows\system32> $shortcut.save() i using firefox test. when run last line, get: "exception calling "save" "0" arguments(s): "unable save shortcut "c:\desktop\firefox.lnk"."" the code seems work other people, setting on computer?

c# - error occurred while parsing EntityName on xml -

i have found there exists "&" in code that's why error showing xmldocument xmldoc = new xmldocument(); xmldoc.loadxml(dsexport.tables[0].rows[i]["submissiondata"].tostring()); the "&" there in submissiondata . how can remove special characters error doesn't show again ? thanks in advance replace "&" "&amp;"

cygwin - Uninstalling GIT on windows -

i have had various msysgit installs on windows vista laptop on past year, using "msysgit-fullinstall", "msysgit-netinstall" , "preview installers. also, installed / used different versions along way. had git binary installed part of cygwin package. screwed along way (actually, not edit .gitconfig anymore), , decided go nuclear , remove git allow me have fresh install (which can love bit more :) ). i tried below steps, still build fails error "old version git-* commands still remain in bindir" - when attempting use net installer. - removed git through add / remove programs in control - removed git files usr/local/bin - , every other " git " file find - removed cygwin enviorment - current %home% directory empty if chose install via "preview" or "full" installers, works, can can use git env / commands - except again cannot edit .gitconfig file, , error message: "error: not lock config file .git/config: no suc...

Three.js: how to punch multiple holes in a shape without distortions? -

Image
i'm trying punch simple square holes in complex three.js shape : var shape1 = new three.shape(shapecoordinates1); punchhole1 = new three.path(punchcoordinates1); punchhole2 = new three.path(punchcoordinates2); shape1.holes.push(punchhole1); shape1.holes.push(punchhole2); etc. because of irregular shape, vertex coordinates overlap punched holes, goes terribly wrong when punching out multiple holes, : this should solid outlined shape around 30 small square holes punched out of it, not huge diagonal white spaces in middle . is there way in three.js prevent behaviour ?

Grails composite id throwing NullPointerException -

i have grails 2.2.3 domain class throwing nullpointerexeption regarding composite id when use dynamic scaffolding. use pidm field primary key, occasionally there 2 records same pidm (same employee, maybe there name change or something) , grails has trouble /show/ uri because multiple rows returned. changeindicator comes in - if changeindicator null, current employee. i'm wondering if problem pidm , changeindicator of 2 different types. does know error might be? below class , error: class employee implements serializable { integer pidm string sid string firstname string lastname string middleinitial character changeindicator static mapping = { table 'employee' id composite: ['pidm', 'changeindicator'] columns { pidm column: 'pidm' changeindicator column: 'change_ind' // more mappings } version false } error: uri /phoneauth/employee/list class java.lang.nullpointerexception messag...

jquery - Assistance with knockout validation -

using knockout library, wrote viewmodel (largely based on online guidance), bit of validation. works perfect except... 1) validation invokes once dialog launched 2) i'd bind validation dialog button instead of input box, , have trigger when users click "add new account" button. a link jsfiddle below. guidance can provide. http://jsfiddle.net/9pv7x/ html <a href="#" id="createaccount">create new account</a> <div id="newaccount" title="new account"> <p> <span class="ui-state-highlight" data-bind='visible: accountname.haserror, text: accountname.validationmessage'> </span> </p> <form> <fieldset> <label for="name">enter account name:</label><br /> <input type="text" id="accountname" data-bind='value: accountname, valueupdate: "afterkeydown"' /> </fiel...

c# - System.AccessViolationException while setting DataContext in Windows Store App -

i navigate new page , on page set datacontext on page load event. public mypage() { this.initializecomponent(); this.loaded += mypage_loaded; } void mypage_loaded(object sender, routedeventargs e) { this.datacontext= mymodel; } while setting data context, lot of times system.accessviolation exception , application quits. what problem? edit i tried following 1) set navigationcachemode disabled 2) made page basic page i.e. remove inheriting layoutawarepage i still getting exception you must ensure data ui binds changed ui thread. can like public static async task runonuithread(dispatchedhandler action) { await coreapplication.mainview.corewindow.dispatcher.runasync(coredispatcherpriority.normal, action); }

image processing - Error from reading with ClearCanvas in DICOM file in C# and how to display the DICOM VCR tag -

i'm receiving error in runtime using clearcanvas libraries. here error could not find file 'c:\users\don jar\documents\visual studio 2010\projects\dicomca\dicomca\bin\debug\fluro.dcm'. the error points section of code: thefile.load(dicomreadoptions.default); i grateful help. thanks public partial class form1 : form { public form1() { initializecomponent(); string filename = "fluro.dcm"; dicomfile thefile = new dicomfile(filename); thefile.load(dicomreadoptions.default); foreach (dicomattribute attribute in thefile.dataset) { console.writeline("tag: {0}, value: {1}", attribute.tag.name, attribute.tostring()); } } } the filename parameter constructor dicomfile sets absolute path of dicomfile. set path dicom file in "picture" folder, mention. the exception seeing caused fact gave relative path dicom file, , trying load in directory applicat...

ios - Why I should access the instance variable directly from within an initialization method? -

the apple programming objective-c document states that: you should access instance variables directly within initialization method because @ time property set, rest of object may not yet initialized. if don’t provide custom accessor methods or know of side effects within own class, future subclass may override behavior. but don't know side effects in setter method, please give me example explain why have access instance variable directly within initialization method the answer simple - code smell. dot notation self.foobar = something in objective-c syntactic sugar messaging. sending messages self fine. there 2 cases need avoid them: 1. when object being created, , 2. when object being destroyed. at these 2 times, object in strange in-between state. lacks integrity. calling methods during these times code smell because every method should maintain invariants operates on object.

maven - Configure the Standard Release Process to Add the CAP File -

i working on custom maven archetype support development of java card applets. i got things working largely already. but, i'm still failing configure release process. the standard is, maven creates jar ./target/classes folder. great, add converted cap release - apk added release if use maven-android-plugin . how can configure this?

java - Checking if a string contains any of the strings in an array -

without () loops such as for(int j =0; j < array.length; j++) { } i want able check if string contains of strings in array globally. for() loops don't work. i have tried int arraylength; while(arraylength < array.length()){ arraylength++; } if(string.contains(array[arraylength]) {} but returns error. edit: to clear up: i want like if (string.contains(**code checks strings in array**) so can check if string contains of strings in array. have mentioned, loops not work because want able execute line of code above anywhere in class. you can this: string veryhugestring = ....;// string[] words = new string[]{...}; boolean foundatleastone = false; (string word : words) { if (veryhugestring.indexof(word) > 0) { foundatleastone = true; system.out.println("word: " + word + " found); break; } } system.out.println("found @ least 1 : " + foundatleastone);

angularjs - Angular - Direction attribute usable in view -

my view looks this: <li game="12.99">game2 <span ng-show="(price > 12.99)">test</span></li> is there way access price (12.99) in view , code like: <li game="12.99">game2 <span ng-show="(price > self.price)">test</span></li> ? use ng-init create $scope property: <li ng-init="price=12.99" game="{{price}}">game2 <span ng-show="price > 12.99">test</span></li>

android - Can't receive LocationClient's location updates after screen gone off -

i'm trying write simple android service runs in background , receives location updates locationclient (google map api android v2). problem when screen go off, service doesn't receives anymore location updates. tried check if service active, screen off, , (i have timertask scheduling log). when screen on can receive location updates, when screen goes off see timertask's logs , don't receive location update. waking screen turns on location updates again. how can solved? here simple service: public class locationservice extends service implements googleplayservicesclient.connectioncallbacks, googleplayservicesclient.onconnectionfailedlistener, locationlistener{ private static final string tag = locationservice.class.getsimplename(); private locationclient mlocationclient; private timer timer; private static final locationrequest request = locationrequest.create() .setinterval(5*1000) // 5 seconds .setfastestinterval(3*1000) // 3 seconds ...

c# - Query a table using Code First and WinForms -

i have 1 user in table users. simple want query records in table. want populate list variable. database: testtf table: users userid int identityfield username nvarchar(64) app.config <configuration> <configsections> <!-- more information on entity framework configuration, visit http://go.microsoft.com/fwlink/?linkid=237468 --> <section name="entityframework" type="system.data.entity.internal.configfile.entityframeworksection, entityframework, version=5.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089" requirepermission="false" /> </configsections> <startup> <supportedruntime version="v4.0" sku=".netframework,version=v4.5" /> </startup> <connectionstrings> <add name="testef" connectionstring="data source=.;initial catalog=testef;integrated security=true" /> </connectionstrings> <entityframewo...

suggestion on table format in c++ -

i need add table format current code. have simpler version of code below. class { public: a():x(0) { } int getvalue() { return x; } private: int x; }; class b { public: b():y(0) { } int getvalue() { return y; } private: int y; }; class c { public: c():z(0) { } int getvalue() { return z; } private: int z; }; class d { public: d(a x, b y, c z) { = x; b = y; c = z; } geta() { return a; } b getb() { return b; } c getc() { return c; } private: a; b b; c c; }; typedef enum { table_a = 0, table_b, table_c, table_d, table_max } table_index; typedef struct tableinfo_tag { table_index id, d d; } tableinfo; tableinfo gtable[table_index::table_max] = { {table_a, {1, 2, 3}}, {table_a, {4, 5, 6}}, {table_a, {7, 8, 9}} } but somehow cannot give values in table class d, accepts constructor. need have table format, ...

c# - ASP.NET <%# versus <% -

this question has answer here: when should use # , = in asp.net controls? 3 answers in asp.net, difference between <%= , <%# [duplicate] 4 answers i'm working on various asp.net pages . for inline functions see 2 different formats used: example 1: <p><%response.write(now())%></p> i see 1 #: example 2: <asp:textbox id="textbox5" width="40" text='<%# databinder.eval(container.dataitem, "name") %>' runat="server" /> i want know exact different , <%# vs <% here explanation here on stack - in asp.net, difference between <%= , <%# [duplicate] summary answers: there several different 'bee-stings': <%@ - page/control/import/register directive ...

Wordpress nav menu works for one site but not the other. -

i have followed instructions on document http://codex.wordpress.org/navigation_menus , has worked every subdomain website, example fit.drttalks.ca not main website drttalks.ca i have gone far copy header.php , functions.php files fit.drttalks.ca, able generate nav menus files of same name drttalks.ca . still hasn't resulted in solution. i confused , have read through of documentation , have run several audits. don't know if may missing call function or if 1 document not working properly.

java - refreshing JTable doesn't show correctly data -

this function should refresh jtable: list = null; list = (arraylist<string[]>) interface_engine.getdata(); info = new string[list.size()][header.length]; iterator = list.iterator(); (int = 0; < list.size(); i++) { string[] current = (string[]) it.next(); (int j = 0; j < header.length; j++) { info[i][j] = current[j]; } } defaulttablemodel model = (defaulttablemodel) data_table.getmodel(); model.addrow(info); when call add new row (getdata remote method retrieve data db), added row it's not display string, a variable reference (such string@128dda...). where's problem? the added row it's not display string, a variable reference (such string@128dda...). read defaulttablemodel api. can't add 2-dimensional array using addrow() method. can add 1 row @ time. the addrow() method should inside loop. build 1 row of data, invoke addrow() method.

c# - Post back list of addresses and send out emails FAIL ON SMTP -

post address post method. want send email address: [httppost, actionname("index")] public actionresult indexpost(suppliersindexvm allsuppliers) { mailmessage mail = new mailmessage(); smtpclient smtpserver = new smtpclient("smtp.gmail.com"); mail.from = new mailaddress("martin.lagan@umac-solutions.co.uk"); mail.to.add("martin.lagan@umac-solutions.co.uk"); mail.subject = "order"; mail.body = "i order following..."; smtpserver.send(mail); return redirecttoaction("index"); } error coming last line: smptpserver.sed(mail)... the smtp server requires secure connection or client not authenticated. server response was: 5.7.0 must issue starttls command first. b20sm10938791wiw.4 - gsmtp any ideas guys.....also how can add tables etc email sending...cheers i believe error due gmail requiring authentication before can allow send...

java - SwingWorker worker with SerialEvent( apped to JTextField ) -

i trying make serialmonitor in java , stuck. try apped text(serial input) jtextarea. tryed using swingworker , had succes not enoughf. i have event(serialeventlistener) wich reads input data. in event trying append incoming data jtextarea wich declared in class , append method wont work. i've read should not work , need use swingworker , did. problem executing process of swingworker starts if give command execute in button event. in conclusion want execute swingworker rutine data serial port. example: serialevent(a data in arrived) -> appedrutine(swingworker) -> finish code: the class holds graphic components: centerpanel import java.awt.borderlayout; import java.awt.color; import java.awt.dimension; import java.awt.gridbagconstraints; import java.awt.gridbaglayout; import java.awt.insets; import java.awt.event.actionevent; import java.awt.event.actionlistener; import javax.swing.boxlayout; import javax.swing.jbutton; import javax.swing.jpanel; import javax.swing.js...

delphi - How to replace or block Windows Taskbar and Desktop for security reasons, programatically? -

like cyber coffee applications disables user ability use other application ones started inside cyber admin application panel, searched internet way of doing in delphi: remove windows task bar; disable alt+tab function; disable task manager; be able do/undo changes in configuration panel. these needs keeping users downloading viruses , making changes windows configuration or play games, if system administrator's preference. the own program serve container authorized applications run inside if mdi application. working of course system manager have options disable or revert. is there way make 4 configurations in run-time delphi xe3 ? i'm not familiar delphi. i'm not sure if possible during run-time. following: write registry prevent alt-tab see this . again write registry disable task manager see this . sounds can disable task bar registry see this . on control panel have options , when hit save, save , restart computer. this provided delphi...

c# - Finding method def for error signature on Windows XP SP3 PC -

i trying find system.dll file open ildasm.exe , find method definition , offset , see why application crashing on windows xp machines only. trying open correct dll assembly listed in error signature? i'm looking in c:\program files (x86)\reference assemblies\microsoft\framework\v3.5 @ system.core.dll because has system namespace in when opened ildasm.exe. the same program runs fine on windows 7 pc. i have following error signature attempting run application on windows xp machine service pack 3. error signature eventtype: clr20r3 p1: myapplication.exe >is exe file name p2: 1.0.0.0 >is exe file assembly version number p3: 51e6a3d8 >is exe file stamp p4: system >is faulting assembly full name p5: 4.0.0.0 >is faulting assembly version p6: 5073c71b >is faulting assembly timestamp p7: 3d57 ...

regex - Substitution with \s does not work as expected -

i write regex remove more 1 space in string. code simple: my $string = 'a string has more 1 space'; $string = s/\s+/\s/g; but, result bad: 'asstringshassmoresthans1sspace'. replaces every single space 's' character. there's work around instead of using \s substitution, use ' '. regex becomes: $string = s/\s+/ /g; why doesn't regex \s work? \s metacharacter in regular expression (and matches more space, example tabs, linebreak , form feed characters), not in replacement string. use simple space (as did) if want replace whitespace single space: $string = s/\s+/ /g; if want affect actual space characters, use $string = s/ {2,}/ /g; (no need replace single spaces themselves).

delphi - Idhttp post session expire -

i'm using idhttp (indy10 delphi-xe2) post form, session expired message site, although i've set cookie manager. thank you. procedure tform2.idcookiemanager1newcookie(asender: tobject; acookie: tidcookie; var vaccept: boolean); begin showmessage(acookie.cookietext); end; the result showmessage is: asp.net_sessionid=enn1xnqde1o1rduedels5fqp; path=/; domain=www8.ticketingcentral.com; httponly; max-age=252028195945; expires=fri, 31-dec-9999 16:59:59 gmt when both max-age , expires present in cookie, max-age takes priority , expires ignored, per rfc 6265. max-age expressed in seconds current clock time. max-age value of 252028195945 ~7991 years in future! adding current clock creates date in year 10004, tdatetime cannot represent (9999 highest year supports). getting rounding issue expiration date being set negative value, representing date in past, not future, expiring cookie before can ever sent http server.

c - Initializing a nested structure -

this problem learn c hardway. database management system in c have 3 structures :- struct address { int id; int set; char *name; char *email; }; struct database { int rows; struct address *row; }; struct connection { file *file; struct database *db; }; i trying initialize database structure. getting segfault void database_create(struct connection *conn, int no_of_rows) { int = 0; conn->db->row_num = no_of_rows; for(i = 0; < conn->db->row_num; i++) { // make prototype initialize struct address addr; addr.id = i; addr.set = 0; // assign conn->db->rows[i] = addr; } } i've made function allocates memory these structures. struct connection *database_open(const char *filename, char mode) { struct connection *conn = malloc(sizeof(struct connection)); if(!conn) die("memory error"); int ...

Finding if value exists in list with LINQ and saving info into a dataset, possibly -

i brand new linq, have loops through orgs user belongs to, make sure have permissions various operations on form. looks this: //loop through user orgs see if selected, have access foreach (orgpermission userorg in user.orgs) { //get org permissions selected org if ((ddlorg.selectedvalue == (userorg.org.orgcode + "-" + userorg.org.orgsubcode))) { if (userorg.type.contains("3") || userorg.type.contains("00")) { / /do here. }}} i trying rid of loop. if user has lots of orgs it's taking little while run, , i'm trying optimize application run time. i tried following: bool has = user.orgs.any(cus => cus.org.orgcode + "-" + cus.org.orgsubcode == ddlorg.selectedvalue); as can see, ddlorg dropdown value in org-suborg format. i'm getting false. i save result, not in bool, possibly single user.org found, can use check permissions , other s...

google apps script - ReferenceError: "$" is not defined in Client Side? -

in google apps scripts, i'm trying use jquery in templating html. i'm receiving following error: referenceerror: "$" not defined. index.html <html> <head> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> </head> <body> favorite google products: <? var data = ['gmail', 'docs', 'android']; ?> <? $(data).each(function(){ ?> <?= ?> <?}); ?> </body> </html> code.gs function doget() { return htmlservice .createtemplatefromfile('index') .evaluate(); } tag <? means code runs on server, , server side seems jquery not loaded, $ reference not exist. something should work without problem: <html> <head> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script> $(function() {...

ios - CLLocation subclassing on OSX -

i'm working on more advanced cllocationmanager mock 1 provided xcode , ran strange issue. have subclassed both cllocationmanager , cllocation : // foobar.h @interface mylocation : cllocation @end @interface mylocationmanager : cllocationmanager @end // foobar.m @implementation mylocation @end @implementation mylocationmanager @end now if build project ios fine when same os x, error @ linking: undefined symbols architecture x86_64: "_objc_metaclass_$_cllocation", referenced from: _objc_metaclass_$_mylocation in appdelegate.o "_objc_metaclass_$_cllocationmanager", referenced from: _objc_metaclass_$_mylocationmanager in appdelegate.o ld: symbol(s) not found architecture x86_64 clang: error: linker command failed exit code 1 (use -v see invocation) unlike in question error on cllocation subclassing , have proper frameworks added project and, said, setup builds flawlessly ios, not osx. fwiw, i'm using xcode 4.6.3 ios sdk 6.1 , o...

java - Making a KeyListener? -

i'm trying make keyeventlistener never prints anything. have main class, need "register" or something? package client; import java.awt.event.keyevent; import java.awt.event.keylistener; public class keyeventlistener implements keylistener { @override public void keypressed(keyevent arg0) { system.out.print("hi1"); } @override public void keyreleased(keyevent arg0) { system.out.print("hi2"); } @override public void keytyped(keyevent arg0) { system.out.print("hi3"); } } awt/swing component must focusable or focus owner in window, otherwise never react key events, , top-level containers too don't use keylistener without important reasons e.g. 3 or more keys presses in same time, e.i. for swing use keybindings instead, ...

Update Statement in ORacle based on data in another 2 tables -

i need update 1 master table based on join 2 tables. anyoe please provide me best approach here need update millions of records using update. maybe example useful: create table a( id int, str varchar2(10)); create table b( id int, str varchar2(10)); insert values(1,'a1'); insert values(2,'a2'); insert values(3,'a3'); insert b values(1,'b'); insert b values(3,'c'); insert b values(4,'d'); /*here query!!*/ merge using ( select id, str b ) b on ( a.id = b.id ) when matched update set a.str = b.str; here other query, maybe have problems null values (try here ): update set str = ( select str b a.id = b.id); you can try here

android - Should I use GoogleAuthUtil to call my backend to secure the communication even I don't need to use the logged Google user? -

i writing game user sends score server maintain. i want secure score has been submitted game app, not curl request or other mean of http request not started app. i read this entry in android developer blog , thought needed implement this, i'm not sure. along score, user send player name typed in edittext player name. means users identified name choose, not google account username. neither client nor server need access google user account @ time. is meant want, or used guarantee 1 http has been performed device of specific google user account? what should pass email gettoken(email, scope) method? my users won't have android accountmanager account. after more diving have concluded that: the email googleauthutil#gettoken() expects email of user's google account. can programmatically retrieved via accountpicker class. explained here . i use method authenticate server calls, think if not plan use user google account information , don't plan use ...

jquery - How refactor switch in javascript for cleaner code? -

i trying write cleaner javascript / jquery code. how refactor function cleaner , smaller. seems there better way this. works i'm sure there better way of getting writing function this. in advance! function filterform(purpose, entry) { switch (purpose) { case 'business' : switch (entry) { case 'single': $("#moreq1").css( "display", "block" ); $("#moreq2").css( "display", "none" ); $("#moreq3").css( "display", "none" ); break; case 'double': $("#moreq1").css( "display", "block" ); $("#moreq2").css( "display", "none" ); $("#moreq3").css( "display", "none" ); ...

java - Split by space but not newline -

i trying convert links in given string clickable a tags using following code : string [] parts = comment.split("\\s"); string newcomment=null; for( string item : parts ) try { url url = new url(item); // if possible replace anchor... if(newcomment==null){ newcomment="<a href=\"" + url + "\">"+ url + "</a> "; }else{ newcomment=newcomment+"<a href=\"" + url + "\">"+ url + "</a> "; } } catch (malformedurlexception e) { // if there url not it!... if(newcomment==null){ newcomment = item+" "; }else{ newcomment = newcomment+item+" "; } } it works fine for hi there, click here http://www.google.com ok? converting hi there, click here <a href="http://www.google.com">http://www.google.com</a> ok? but when string : hi there, click here http://www....

javascript - How to alert every occurence? -

i need send alert user every time z-index equals 2. unfortunately occurs onload, or ready...whatever... heres html <div id='slides'> <img class='sliderimg' src='img.jpg'> <img class='sliderimg' src='img.jpg'> <img class='sliderimg' src='img.jpg'> </div> and javascript document.ready=function(){ var theimage=$('.sliderimg')[0]; if(theimage.style.zindex==2){ alert(theimage.style.zindex); } } you have 2 choices: 1) run timer , call function periodically, using setinterval or settimeout 2) listen dom changes , run function.

ms access - Using SQL for deduplication, SELECT similar fields -

i have access orders database containing 500+ customer names in field called "customername" the problem orders entered, our sales team types names differently. ("acme inc" vs "acme, inc.") have several customers same company, appear differently. so far i've written query shows distinct customername values, , need query can go through of these , show me names similar. perhaps if first ten letters of name matches? or ideally, if percentage of letters of name match. i'm @ loss on how this, appreciated. thanks much! this depends on how names vary. if punctuation, case etc. can strip , compare based on that. if more complicated e.g. "inc, acme" vs "acme incorporated" have write function compare 2 strings score/rank them. finding how similar 2 strings are the above link question talks different algorithms used this. levenshtein distance in excel the above link question has implementation of 1 of metho...

vb.net - how to look up a a value from another datatable and display it in an unbound column of a bound datagridview -

i'm sorry, tried search answer i'm having hard time translating examples i've found own scenario. i have ms access database has "employees" table following columns: "employee id", "name", "middle", "last", "hire date", "fired date". another table "work" has columns: "date", "employee id", "activity", "hours worked", "department", "shift", "equipment used", a datagridview bound "work" table. call fillbydate() query made query editor @ design time entries specific date loaded. i create unbound column display name (name, middle, , last) of employee "employees table" using employee id find it. i'm new coding vb.net, might reason why don't understand or find right examples. appreciate sample code , comments each step see how things working. just fyi i'm reading couple of coding bo...

javascript - Moving through an array one by one on click -

Image
i have interaction populates/repopulates modal on click. population happens through traversal of key values of json object. need have bit of logic sets these keys' index (back or forth) depending on users clicks. the arrows in top right corner( .next .prev ) trigger , forth traversal. unique post json data updated. i've put comments inside code , jsfiddles ease of reading. need traversal have bit of validation when hits end of array go start , vice versa. must abide next , prev button constraints because triggers synchronizes multiple interactions i've made prior to. code: jsfiddle /* sample of data =============== var data = { created_at: "2013-07-15t05:58:25z", id: 21, name: "skatelocal.ly", svg : "<svg> ... </svg>", post_a : "this awesome post 1", post_b : "this awesome post 2", post_c : "this awesome post 3", post_d : "this awesome po...

php - Listening for 2 Pusher apps in same page using Javascript -

i have been using pusher quite few months success. won't go details of "push" part of solution because works already. issue listener side when try listen second app. please note said second app not second channel on same app. here have has worked @ least 6 months , continues work until try add second version of on same html/php page in head section. i have changed keys info obvious reasons. how can add second copy of pointing second app within pusher? my concern have issues if there things identical variables such channel. have tried renaming channel channel 2 , pusher pusher 2 quits working.. <!-- start pusher code --> <script src="https://d3dy5gmtp8yhk7.cloudfront.net/2.1/pusher.min.js" type="text/javascript"></script> <script type="text/javascript"> var pusher = new pusher('0000000000'); var channel = pusher.subscribe('appname'); channel.bind('channelname', fun...

javascript - Very high processing difference between two almost similar while loops -

i'm writing function draws image canvas element pixel pixel. noticed there point, function took way longer process before - going 338x338 pixel canvas 339x339 pixel canvas. putting similar looking function jsfiddle, same result. while loop processing array of 338x338 takes approx. 6-7 seconds, while array of 339x339 takes approx. 24-25 seconds. this happening on chrome. in firefox both takes approx. 16 seconds. here fiddle: http://jsfiddle.net/8pb89/5/ the code looks this: var ary1 = []; var ary2 = []; var mapdata = {}; var colormatrix = {}; (var = 0; < (338 * 338); i++) { ary1.push([i, + 2]); } (var = 0; < (339 * 339); i++) { ary2.push([i, + 2]); } //light operation function test(i, j) { return math.floor((i * j + + j) / j); } //heavy operation on objects function calctest(ary){ var point = ary.splice(0, 1); var = point[0]; var j = point[1]; if (!mapdata[i]) { mapdata[i] = []; } if (!mapdata[i][j]) { mapd...