Posts

Showing posts from March, 2010

Best guidance for One time user authentication & wcf service -

i new in wcf service , have seen people send user credential when made function call of wcf service below way. private static void main(string[] args) { servicepointmanager.servercertificatevalidationcallback = new remotecertificatevalidationcallback( delegate { return true; }); var client = new wcfserviceclient(); client.clientcredentials.username.username = username; client.clientcredentials.username.password = password; console.write(client.getdata(1)); client.close(); console.read(); } i want pass user credential once , after authentication user can call service function many time without credentials. guide me how design kind of service. looking small sample code me learn & implement. thanks you need enable sessions on service , client can establish session service. can happen while same channel used communicate service. in above code, example, session terminated when called close(). in order establish security

javascript - Extending Ember.ArrayProxy -

how extend ember.arrayproxy? have tried following: ember.arrayproxy.reopenclass({ flatten: function(){ var r = []; this.foreach(function(el) { r.push.apply(r, ember.isarray(el) ? el.flatten() : [el]); }); return r; } }); but ended writing following solution: // source: https://gist.github.com/mehulkar/3232255 array.prototype.flatten = ember.arrayproxy.prototype.flatten =function() { var r = []; this.foreach(function(el) { r.push.apply(r, ember.isarray(el) ? el.flatten() : [el]); }); return r; }; is there i'm missing in former example? i'm trying stick ember's methodology, prefer not use later. if you're using flatten on instances of arrayproxy you'd want use reopen , , not reopenclass . reopenclass adds method class itself, aka call em.arrayproxy.flatten() http://emberjs.jsbin.com/oqufobeg/1/edit

c# - Geospatial search in Lucene 3.0.3 - API Breaking chages? -

i trying implement geospatial search in latest version on lucene.net (3.0.3). i have installed lucene.net (3.0.3), lucene.net contrib (3.0.3) , lucene.net contrib spacial (3.0.3). i using excellent example simple spacial search working. http://www.leapinggorilla.com/blog/read/1010/spatial-search-in-lucenenet---worked-example it includes following line: iprojector projector = new sinusoidalprojector(); var ctp = new cartesiantierplotter(0, projector, fields.locationtierprefix); the classes / interfaces iprojector, sinusoidalprojector , cartesiantierplotter cannot found. from docs should located here. lucene.net.spatial.tier however entire namespace missing. can 1 examplain how above example working in latest version of lucene , how api has changed regarding these classes in latest release? i joined lucene.net mailing list , put question on experts. i've included response itamar syn-hershko below. yes, lucene.net 3.0.3 using different spatial sea

PHPStorm Regex Replace with back calls -

i want use phpstorm find , replace instances of: [a-z]['][s] example: andy's or david's to: andy\'s or david\'s i have regex above, want know how use found character in regex in replace. there several problems regex way have it: [a-z]['][s] you can't use shortcut [a-z] range of upper , lower. need use [a-za-z] . don't need apostrophe , s in brackets: [a-za-z]'s then, replace matched group, use $ groups: ([a-za-z])'s , replacing $01\\\\'s

javascript - angular ui-router, how to nest states with a url that updates -

i'd know how join 3 states when running through wizard-like setup. app i'm developing has "parameters" screen asks user in 3 steps enter parameters. these 3 steps should joined on same page current step should visible when particular step needs filled in. somewhat this: user starts at: parameters/step-1 first div visible second div hidden (or in sort of blocked/locked state) third div hidden (or in sort of blocked/locked state) user fills in step 1 , navigates parameters/step-2 first div visible second div visible third div hidden (or in sort of blocked/locked state) user fills in step 2 , navigates parameters/step-3 first div visible second div visible third div visible this current setup, correct way of doing or should work nested views , show/hide each view manually depending on current route? , if so, how do this? .state('test.parameters', { url: "/parameters", templateurl: "views/partials/enter-paramete

Neo4j cypher query from Training -

i finished training @ http://www.neo4j.org/learn/online_course , had couple of questions lab answers. the first advanced graph lab in lesson 2. (no answer given , doesn't verify in graph widget thingie) the question is: recommend 3 actors keanu reeves should work (but hasn’t). hint should pick 3 people have acted_in relationships movies keanu hasn't acted_in. the graph has person nodes , movie nodes acted_in relationships , directed relationships. i came this: match (a:person)-[:acted_in]->(movie:movie) not (:person {name:"keanu reeves"})-[:acted_in]->(movie) return a, count(movie) order count(movie) desc limit 3 but couldn't tell if excluded same movie or keanu reeves (because actors returned hadn't been in keanu's movies, might have been returned anyway. i've found 2 solutions far. 1: recommend busiest actors keanu reeves has not acted with. match (p:person)-[:acted_in]->(m) p.name <> 'keanu reeves&#

Automatic Macro in Access to check today date minus date on table -

is there automatic way scenrio in access? i have table have startdate, enddate , checkerbox what goal today january 31, want vba or macro in access check if enddate=today should check checkbox if not leave that... i'm looking way this... suggestion welcome thanks try in vba : private sub form_current() if datediff("d", inputenddate, date) = 0 chkdate = 1 ' check checkbox chkdate end if end sub

xpath - Looking for n-th instance of x node in root node -

suppose have following xml <root> <x> <y /> <z> <y /> </z> <n> <m> <y />* </m> </n> </x> <x> <y /> <z> <y /> </z> <y />* </x> </root> i retrieve y nodes followed * so third node in x ancestor node i tried like: //x//y[3] however doesn't work guess work if y nodes on same level. so tried (//x//y)[3] retrieves 1 node (third one) in whole document so tried like: //x(//y)[3] //x(//y[3]) //x//(y[3]) etc. parse error is there way retrieve need using xpath? use: //x/descendant::y[3] this selects every third y descendant of each x in document. helps write out expanded expression see what's going on. in case, following: //x//y[3] is equivalent to: /descendant-or-self::node

rdf - Correct usage of owl:someValue? -

if want every thing has book literacy, correct representation in owl ontology? <owl:class rdf:about="#literacy"> <owl:equivalentclass> <owl:restriction> <owl:onproperty rdf:recource="#has"/> <owl:somevalue rdf:recource="#book"/> </owl:restriction> </owl:equivalentclass> </owl:class> this seems related earlier question, meaning of owl:hasvalue? . there's no property owl:somevalue , so, code you've shown not legal owl class expression. i'd assume trying write owl version of axiom: literacy ≡ ∃has.book (or, in manchester syntax: literacy equivalentto (has some book)) this doesn't make sense me, , think might issue english; “literacy” state of “being able read.” person able read literate ; possess quality of literacy . make more sense talk concept literatething, i.e., class of things literate. if that's mean, write axiom li

internationalization - Add another custom interpolator in Angularjs -

i still want {{1+2}} evaluated normal. in addition normal interpolator, want create custom 1 can program whatever want. e.g. <p>[[welcome_message]]</p> should shortcut <p>{{'welcome_message' | translate}}</p> , or <p translate="welcome_message"></p> . way, i18n apps more convenient write. is possible? i'm going through angular.js source code, interpolation system looks pretty complicated(?). suggestions? i created directive regex-find-replaces it's innerhtml. basically, can rewrite text other text. here's how did it: how make angular.js reevaluate / recompile inner html? now have place directive-attribute, " autotranslate ", in 1 of parent elements of want interpolator work, , rewrites want it! :d <div class="panel panel-default" autotranslate> <div class="panel-heading">[[welcome]]</div> <div class="panel-body"> [[hello_worl

php - How to handle a set of array inputs and insert multiple rows -

i have 2 tables namely invoice , purchase_list. invoice : invoice_number, invoice_date, customer_id, invoice_purchase_value, invoice_tax, invoice_bill_amount purchase_list purchase_id, invoice_number, customer_id, purchase_rate, purchase_quantity, purchase_value for particular bill, insert bill's main details in invoice table , corresponding products purchase list in purchase_list table. usually many products been purchased in 1 invoice. here comes problem. 1 insert statement enough invoice table. but, purchase_list, multiple insert statements required. (for ex, if 6 items purchased in 1 invoice, 6 insert statements should executed.) i in thought of sending purchased values in array format php. if so, how can extract values arrays , insert purchase_list table or other ways implement same..? i newbie mysql. please brief in detail. thanks in advance. look pdo prepared statements.

java - use different types, or use Object? -

sorry noobish question, why use string , int , others, if can use object type? i mean use object one; instead of string one; for example, string class declares bunch of methods. if variable declared object , methods declared in object , super classes (none) visible on variable, regardless of type of actual object. you can do string 1 = new string("whatever"); system.out.println(one.length()); but can't do object 1 = new string("whatever"); system.out.println(one.length()); methods , fields resolved on compile time type of variable.

angularjs - Accessing variable defined in slickgrid in AngulaJs -

i have array defined in slickgrid captures rows edited in grid using oncellchange event. want access array in angularjs controller can send edited rows backend. have searched question , got know need use $window in controller access global js variable. it's not working me. have read how access global js variable in angularjs directive , http://code.angularjs.org/1.1.5/docs/api/ng.$window infact in 2nd link(above) , many people have commented it's didn't work them either. can please tell me missing? slick_grid.js var editedrows = []; grid.oncellchange.subscribe(function(e , args){ var item = args.item; for( i=0;i<editedrows.length; i++) { if(item.employeeid == editedrows[i].employeeid) { editedrows.splice(i , 1 , item); return; } else { editedrows.push(item); return; } }

javascript - Declaration 2d array containing multiple objects for graph plugin? -

i using igdoughnutchart web-page, want graph shows following hierarchy source of attack (inside) login abuse dos spyware worm outside attackers spying social attacks the current object array looks (also demo ) var data = [ { "attacksource": 43, "attacktype": 60, "at":"dos","label": "inisde" }, { "attacksource": 29, "attacktype": 40, "at":"login abuse","label": "outside" } ]; i want change following:- (also shown above) where have parent , child values in 2d array above code transform as var data = [ [{"attacksource": 43,"label":"inside"}], [ {"attacktype": 13,"label":"dos"}, {"attacktype": 13,"label":"virus"}... ] ]; i'm not sure

Populate an existing array from XML -

i've searched averywhere, can't find answer applies me. have as3 array currentely populated manually inside script , rest of code array. how can 'convert' array populate using xml without affecting rest of code. code: var my_info_array:array = new array("info-pdf.swf", "info2-pdf.swf"); //this first line want populate using xml without affecting code below var infourlnow:number = 0; var mytimer2:timer = new timer(5000); mytimer2.addeventlistener(timerevent.timer, timerlistener); function timerlistener (e:timerevent):void{ if(infourlnow != totalinfo) { loadinfo(); } else { infourlnow = 0; loadinfo(); } } mytimer2.start(); loadinfo(); function loadinfo(){ var infoloader:loader = new loader(); var infourl:string = my_info_array[infourlnow]; var infourl:urlrequest = new urlrequest(infourl); infoloader.load(infourl); info_kozel.addchild(infoloader); infoloader.x = 20; infoloader.y = 20; in

nosql - Non idempotent SQL command with OrientDB JDBC Driver -

hello, i'm facing issue while using jdbc driver connect plocal orient db. here code: properties info = new properties(); info.put("user", this.user); info.put("password", this.pwd); java.sql.drivermanager.registerdriver(new com.orientechnologies.orient.jdbc.orientjdbcdriver()); connection conn = (orientjdbcconnection) drivermanager.getconnection(this.url, info); string sql = "insert personne (name) values(?)"; preparedstatement stmt = conn.preparestatement(sql); stmt.setstring(1, "test recuperation rid par jdbc"); resultset rs = stmt.executequery(); ... and here exception stack; exception in thread "main" com.orientechnologies.orient.core.exception.ocommandexecutionexception: cannot execute non idempotent command @ com.orientechnologies.orient.core.storage.ostorageembedded.executecommand(ostorageembedded.java:90) @ com.orientechnologies.orient.core.storage.ostorage

Grant privileges to user in MySQL -

from control panel of website have created new mysql(5) database test , new user admin password 123 . have tried assigning privileges user admin using: grant privileges on *.* 'admin'@'localhost' or grant privileges on *.* 'admin'@'test' i keep getting following error: #1045 - access denied user 'admin'@'%' (using password: yes) i need following privileges user admin : create, alter, delete, insert, select, update, lock tables how make in query phpmyadmin? i guess trying change privileges of 'admin'@''%' being logged in user. strange. you can display user logged in using select user(); then check grants account has: show grants 'admin'@''%'; we came conclusion have grant privileges on `test`.* 'admin'@'%' that says have privileges on tables in database test . cannot further grant privileges other users, though (otherwise there wi

lotus notes - Calendar Button Entry -

i have button notes calendar entry. basically creates new entry when 1 clicks on it. this full script: sub click(source button) dim s new notessession dim db notesdatabase dim doc notesdocument dim subject string dim maildoc notesdocument dim rtitem notesrichtextitem set db = s.currentdatabase set doc = new notesdocument(s.currentdatabase) set maildoc = new notesdocument(s.currentdatabase) set ritem = new notesrichtextitem(maildoc, "body") 'modify subject, location, start day , time, end day , time before sending!! '######################################################################### doc.subject = "hi" doc.location = "i2-300" set startdatetime = new notesdatetime("05/29/2014 04:00:00 pm") set enddatetime = new notesdatetime("05/29/2014 05:00:00 pm") '######################################################################### doc.from = s.username

how open url with click on one div in Watin automation -

how open url click on 1 div in watin automation i going url code browser.goto(address); browser.waitforcomplete(); and click on div this var main_tab1 = browser.div(find.bytext("main_tab")); main_tab1.click(); i want when browser going url div cliked and no need click ... , automation faster i not sure if have understood question right. asking whether need navigate page on click on div using browser.goto(address)? if so, try navigate directly address. capture url when u click on div , send goto method.

javascript - Can a user permanently amend an HTML file through the browser? -

for example- user change actual code of html web browser using javascript prompt? if had following code. <html> <head> <script>var person = prompt("please enter name");</script> </head> <body> <p>this should user amendable</p> <p>this shouldn't</p> </body> </html> i don't mean store variable person temporarily, change html code , replace value of variable? not such. alternatives include: you take changes , send them server using xmlhttprequest. server respond storing them , sending new version requested in future. you store changes in local storage / cookie / etc, , include javascript in page looks data , updates page loads. a browser plugin written store modifications made given url.

Test Suites for OpenStack Nova CLI -

i wondering if there test suite openstack nova command line interfaces. googled , found bunch of integration test suites (tempest, torpedo, stacktester, smokestack). unfortunately, none of these test suite provides tests nova cli. are aware of nova cli test suites? i'd test sequences of commands like. nova boot ... nova list nova image-list thanks tempest , framework looking for. there provision in tempest run different kinds of testsuites api,cli etc.you can test above mentioned commands using cli testsuite

ssis - dtexec error "The connection xxx is not found" with Project deployment model -

when running dtexec getting "the connection xxxx not found". i beleieve because connection managers located @ project level , not within package itself. when running dtexecui - these connection managers not displayed. is way move them package - seems bit weird point of allowing them project level if have move them use them dtexec. thanks here command line syntax asked for: c:\users\administrator>dtexec /file "\"f:\ssis projects\hesa\hesa\01 - upload metadata files oracle.dtsx\"" /set "\package.variables[user::varyear.properties [value]";"1999" /checkpointing off /reporting ew /consolelog smt your assumption that the connection managers located @ project level , not within package itself is problem. there solution: build project .ispac file instead of invoking dtexec /file have invoke /project , /package , this: /project "path .ispac file, resulting building project" /package "

Convert Youtube Url to Video Flash Url Asp.Net MVC -

i using microsoft web helpers in application , using @video.flash(path: " http://www.youtube.com/v/o3mp3mjdl2k ", width: "200", height: "200") to embed youtube url. the actual url youtube video http://www.youtube.com/watch?v=o3mp3mjdl2k i wondering if there utily or regex convert above url embed url format(/v/) ? if other members embedding videos in website , curious know how doing this. thanks

node.js - Forcing node to not create a session in connect-mongo/connect-mongostore -

we running on amazon, using node express, , connect-mongostore manage sessions. load balancer sends test servers every 15 seconds make sure app alive. have coded api call check, tests if both node , mongo working. however, creates session, each call, it's not web browser, new session record gets built. have 80,000 records in our session database, expire every 4 weeks. wondering if there way prevent happening, without having hack either express or connect-mongostore. at 1 time ignore specific routes connect's session management connect.session.ignore.push('/individual/path') , has been removed. why not put 1 public route app.get app.use('/lbchck', function(req,res){ res.send(200);}) load balancer before app.use(express.session(...)); ?

jquery - html table column sizing -

i'm trying create simple html table (one row columns). want 1 column overflow scroll bar. problem no matter css setitngs change column size changes according text, , scroll bar horizontally , not vertically. needs changed in order table way want? html code: <table class="homepage_table"> <tr > <td id="articlesbar" width="20%" > <%@include file="newsdata.jsp" %> </td> <td id="about_td" width="80%" > <div class="fadein"> <img src="imp.gif"> <img src="http://thefinancialbrand.com/wp-content/uploads/2008/08/tagline-tagcloud.gif"> <img src="slogan1.gif"> </div> <div id="about_text" width="100%" height= "100px" > founded in 1992 finance , securities company, imperia bank conver

parsing - What is the best way to read a file in Java? -

i writing java program simulate assembler (as assignment in college). i have assembly program given input assembler. the general format of every statement in assembly code follows: [label] opcode operand1 [operand2] (each term separated space) label , operand2 optional parts in statements these may unavailable. in java code read each line , use stringtokenizer 4 parts separated spaces. my question whenever label and/or operand2 not available how can find out first values returned stringtokenizer opcode value , second value operand1 value? best way this? thanks lot if a label can never opcode , and depending how many opcode values exist, you might create method isopcode(string s) , test first part after tokenizing. if passes, label must have been missing. if fails, label must exist. depending on results of test, can count remaining parts determine if operand2 present.

reporting services - How to use an indicator on SSRS 2008 -

hello producing report on ssrs 2008. using indicator. in 1 of text boxes have percentage. want link indicator percentage so. example: want percentage 90%. want indicator turn green circle if 90% or above , want red x if 89% or below. how format expression can achieve goal? in advance i code following indicator value: = iif ( reportitems!mypercentage.value >= 0.9 , 1 , -1 )

oop - Design of a simple has and belongs to many dependency in a web application -

i have 2 simple entities. a foo simple data container. end user can view , modify list of foos. a bar list of foos. user can remove foos, or add new foos list each bar. in database, simple habtm relationship. there's foo table, bar table, , join table. on client, bars need notified when member foos change. example, let's if foo changes, bars containing foo should display symbol indicating have new data, or animation. i'm not sure 2 things: how store , manage foo data, , how notify affected bars. foo data the logical solution seems delegating database. after all, implements joining relationship between foos , bars, why should duplicate on client-side? mean posting every change user makes foo db, , refetching bars db. performance-wise it's wasteful, because i'm querying server data have. from performance / simplicity pov, obvious implementation bars on front-end have references foos, i'm unsure this. wouldn't defeat purpose of having relati

yii - Multiple GET parameters in UrlManager -

i using yii 1.1.14. i want convert http://website.com/controller/action?param1=value1&param2=value2 http://website.com/value1/value2 how in urlmanager? first, check hide index.php: http://www.yiiframework.com/doc/guide/1.1/en/topics.url#hiding-x-23x then, route in config.php should this: '<param1:\w+>/<param2:\w+>'=>'mycontroller/myaction', the method myaction should accept $param1 , $param2 in constructor passed automatically yii. this make app unable other controllers, because rule accept every route 2 words separated /

JavaScript - How to use Map instead of For Loop -

i want use map instead of loop in example. have csv files contains data csv file address,type,building,geometry "this","is","an","example" "this","is","an","example" "this","is","an","example" "this","is","an","example" "this","is","an","example" "this","is","an","example" "this","is","an","example" var geojsonfeature; var globaldata= data.map(function(d){return json.parse(d.geometry);}); var buildingdata= data.map(function(d){return json.parse(d.type);}); (i=0;i<globaldata.legnth;i++) { geojsonfeature = { "type": "feature", "properties": { "name": buildingdata[i] }, "geometry": { "type&qu

nosql - CouchDB filtering on key array -

given couchdb view emits this: emit([doc.name, doc.date], doc) how filter on multiple doc.name values? below doesn't seem work. keys=[["name1",{}],["name2",{}],["name3",{}]] when specify keys parameter, specifying exact match. assuming want range query (every document name="name1" no matter date) need query startkey , endkey: ?startkey=["name1", ""]&endkey=["name1", {}] and have repeat query each name.

android - Libgdx Reading External Resources -

in desktop application can load texture this texture texture = new texture(gdx.files.absolute("c:/picture.png")); how can in android? external relative sd card. this: texture texture = new texture(gdx.files.external("picture.png")); will in root of sd card.

Connecting from Tableau Desktop to Apache Hive -

when testing connection tableau desktop apache hive server, throws error drivers have not installed. tableau providing drivers cloudera, hortonworks , mapr. but, drivers not provided apache hive. how connect tableau desktop apache hive? i got working using mapr driver. reference http://doc.mapr.com/display/mapr/hive+odbc+connector#hiveodbcconnector-installingthehiveodbcconnectoronwindows

android - Scrolling layout in automatic test -

i develop automatic test in selenium appium using python. need scroll item list, don't have idea, how it. try: scrolllayout = android.driver.find_elements_by_class_name("android.widget.relativelayout") params = {"element": scrolllayout[0].id, "text": search_string} self.android.driver.execute_script("mobile: scrollto", params) but, it's not working. should do? webelement list = driver.findelement(by.id("id of list")); hashmap<string, string> scrollobject = new hashmap<string, string>(); scrollobject.put("text", "name search"); scrollobject.put("element",( (remotewebelement) list).getid()); driver.executescript("mobile: scrollto", scrollobject); if(scrollobject.containsvalue("string search")) { system.out.println("found"); list<webelement> list_user = list.findelements(by.id("id of tex

php - mysql UPDATE not changing table -

i have made form allow changing users "userlevel." however, cannot seem work. not changing userlevel after submit. php newbie. have tried researching past hour , cannot seem make progress here. simple missing. appreciated. the form <form action="dm/userupdate.php" method="post"> username: <input type="text" name="username" value="username"> <br> user level: <input type="number" name="userlevel" value="0"> <input type="submit" name="submit" value="change"> </form> userupdate.php <?php mysql_connect('localhost', 'username', 'password') or die(mysql_error()); mysql_select_db("database") or die(mysql_error()); $userlevel = mysql_real_escape_string($_post["userlevel"]); $username = mysql_real_escape_string($_post["username"]); mysql_query($con,"update user

java - Generating and serving XML files on GAE -

i'm using play framework 1.2.4 , deploying application on gae. i'm trying data datastore , create xml file based on data. then, have javascript use file populate google map. (the xml file has latitude , longitude). once, deploying application it's not working 'cause can't write/create file on server. i've tried before work json object instead of xml didn't work. is there way can resolve , work xml file? why need create actual file? , why json vs xml make difference? just write handler queries datastore returns data directly, in whichever format need.

jquery - Adding UL or OL to an HTML class -

i'm working on webhelp project css attached. when word documents converted topics corresponding css styles convert word documents ready formatted html topics, except bulleted , numbered headings. there way attach ul and/or ol tags class, numbered , bulleted levels format automatically when document converted? i've seen references jquery on topic. not know jquery assume name conditional statements created automate coding. i'm swinging in dark there. however, pick (jquery) if needed. here's example of code add ol tags to: <p class="step">1.<span style="font: 7.0pt 'times new roman';">&#160;&#160;&#160;&#160;</span>&#160;on insert tab, in illustrations group, click <span class="commandtext">shapes</span>.</p> <p class="step">2.<span style="font: 7.0pt 'times new roman';">&#160;&#160;&#160;&#160;</span>&#1

javascript - jQuery animation inside recursive function very slow -

i have small animation of arrow bouncing horizontaly on 3 car pictures. arrow starts 200ms per bounce , time increases 200ms each turn, until stops on 7th turn on car #3. it works on chrome , firefox smoothly. on safari 7 starts fast , after 2 laps becomes slow , skips lot of frames. the javascript code following: var fwd = true; var cnt = 6; var time = 200; function play(){ var tgt = fwd ? '310px' : '10px'; $('#arrow').animate({left: tgt}, time, function() { if (cnt > 0){ cnt--; fwd = !fwd; time += 200; play(); } else { finaltarget(); } }); } function finaltarget (){ $('#arrow').animate({left: '230px'}, 466, function(){ $('#car3').hide(0).show('pulsate', {times: 3}, 600, function(){ $('#car1, #car2').fadeto('slow', 0.3); }); }); } the code on jsfiddle http://jsfiddl

nested - SQL Query to find the value which has max number of occurrences in a table without nesting -

i'm working on following schema (bold text stands pk, , ":" stand referenced tables) : users( username , name, surname); products( id , name, quantity); purchases( user:users, product:products, dateandtime , quantitypurchased); i want find name , surname of user has made max number of purchases. firstly use nested query find out number of purchases each user , select user purchased >= values: select name, surname, username users join purchases on username = user group name, surname, username having count(*) >= all( select count(*) utenti join acquisti on username = user group username) is there way achieve same without using nested queries? thank in advance time. yes there is. sounds homework assignment, seem have put work it. idea order count(*) , take first row. syntax in sql server, sybase, , access is: select top 1 name, surname, username users u inner join purchases p on u.username = p.user group name, su

android - Scheduled sync adapter runs every 30 seconds -

i use sync adapters in application sync changes server periodically. no matter value put in pollfrequency sync runs every 30 seconds. i checked on forum , tried changes suggested in replies , pass 'false' synctonetwork parameter when raise notifychange on contentresolver. on going through training again in detail, stumbled upon difference. on google developer site -> training section sync adapters training see addperiodicsync -> pollfrequency parameter passed in milliseconds public class mainactivity extends fragmentactivity { ... // constants // content provider authority public static final string authority = "com.example.android.datasync.provider"; // account public static final string account = "default_account"; // sync interval constants public static final long milliseconds_per_second = 1000l; public static final long seconds_per_minute = 60l; public static final long sync_interval_in_minutes = 60l; //this line i'm referring

ruby - Calling a method inside a method -

in recreating enumerable module practice, have #any figured out. def my_any? = false self.each |item| #i switched `each`. originally, had written `my_each` = true if yield(item) end end now, create #none? have this, right? def my_none? !(my_any?) end however, when call method, error: arr = [1,2,3] arr.my_none?{|x| x>2} localjumperror: no block given (yield) you using yield keyword in my_any? , requires block. can capture block given my_none? , pass along: def my_none? &blk !(my_any? &blk) end

Trying to understand this lambda expression in scheme -

can please expression: ((lambda (a b) (* ***(b a)*** a)) 5 (lambda (c) (+ c (* 2 c)))) now understand expression = 75 , understand first lambda takes arguments , b = 5 , b = (lambda (c) (+ c (* 2 c))) = 15 part of expression don't understand part have put in bold , italics. in basic terms how expression read? this snippet: (b a) expresses fact b function, , it's being applied a parameter. in particular, value of a 5 , , value of b function: (lambda (c) (+ c (* 2 c))) so, replacing obtain: (* (b a) a) (* ((lambda (c) (+ c (* 2 c))) 5) 5) (* (+ 5 (* 2 5)) 5) 75

java - How do I know a Longitudinal redundancy check is correctly calculated and how is it used to ensure that data before is not corrupt? -

how know longitudinal redundancy check correctly calculated , how used ensure data before not corrupt? this how i'm calculating right in java how know calculating correctly given data? byte[] testmessage1 = {0x02, // stx 0x10,0x2,0xa,0x10,0x10,0x7,0x8, // data 02, a, 10, 7, 8 0x03, // etx 0x2^0xa^0x10^0x7^0x8^0x03}; // lrc calculated data (with dle removed) plus etx public static byte calculatelrc2(byte[] bytes) { byte checksum = 0; (int = 1; < bytes.length - 1; i++) { checksum ^= (bytes[i] & 0xff); } return checksum; } you looking answer of wrong question in opinion because lrc check find out weather reading data correctly or not not other way around. if want validate implementation create unit tests real examples. please remember lrc validate if data read source correct (and not tempered or faulty) lrc must available within data code make sure lrc calculating , lrc available in source matching. i

R scatterplot3d: a custom axis step and ticks -

Image
greeting all. i striving scatterplot3d plot -- graphical representation of data.frame of 3 variables 1 of them response variable, have wrong representation of axis steps. here code ("temp" data.frame): library(scatterplot3d) temp[,1] <- as.numeric(levels(temp[,1]))[temp[,1]] (m in temp[,2]) m <- as.factor(as.numeric(m)) (m in temp[,3]) m <- as.factor(as.numeric(m)) colnames(temp) = c("values", "factors", "antifactors") # "values" responce variable xtickmarks<-c("antifactor1","antifactor1", "antifactor3") ytickmarks<-c("factor1","factor2") plot3d <- scatterplot3d(temp[,3], temp[,2], temp[,1], color = "blue", pch = 19, type = "h", box = t, xaxt = "n", x.ticklabs=xtickmarks, y.ticklabs=ytickmarks, zlab = "time, min.") dput(temp) structure(list

javascript - Does JS bind grab the state of an obj or keep a reference to the obj? -

my issue array i've bind'ed async function doesn't seem updated on subsequent calls of function though bind'ed array updated inside function. in function below call queryfordata several times asynchronously. passing in history declared globally. log1 prints out empty array , log2 prints out array retrieved correct data iteration. however, doesn't seem concat array retrieved in other calls. please help exports.callquery = function(req, res) { var http = require('http'); var history = []; // loop on entries in "stocks" collection // , call queryfordata stocks.find(function (err, stocks){ stocks.foreach(function callback(entry){ queryfordata(entry, this.history); }.bind({history : history}) ); }); // perform http request data , call callback // function concats data arrays together. var queryfordata = function(stockdata, history) { var options = { host: 'query.blah.com',

ios - Not able to find photos on MBP -

this code can't find photos macbook pro (meta nil). trying test code on mbp. photos exist in iphoto. code works iphone/ipad? if yes, how test code on mbp? alassetslibrary* library = [[alassetslibrary alloc] init]; [library enumerategroupswithtypes:alassetsgroupall usingblock:^(alassetsgroup *group, bool *stop) { if (group) { [group setassetsfilter:[alassetsfilter allphotos]]; [group enumerateassetsusingblock:^(alasset *asset, nsuinteger index, bool *stop){ if (asset){ nsdictionary *meta = [[asset defaultrepresentation] metadata]; } }]; } } failureblock:^(nserror *error) { nslog(@"error enumerating assetlibrary groups %@\n", error); }]; alassetslibrary only available ios . assume you're running ios app in simulator, right? ios apps running in simulator or device can't access native mac resources, due app sandboxing, , other similar reasons.

jquery - Button function only works on first click -

i trying button work throughout multiple clicks change displaying users on every click button working on first click. i have hunch either has got ajax or fact each time button clicked button drawn. i can verify getdata.php working fist click. html button: <button id="search">seach</button> jquery function button: document.getelementbyid('search').addeventlistener('click', function (e) { var info1= document.getelementbyid("datainput").value; var div = document.getelementbyid("contentdisplay"); //removes current data displaying while( div.haschildnodes() ){ div.removechild(div.lastchild); } var midhtml; $.ajax({ async: false, type: 'post', url: 'getdata.php', data: {key: "search", info: info1}, success: function(data) { if(data.length > 10){ div.innerhtml = html+data; }

jquery - Delay with slow fade in after rest of page is loaded - Javascript -

basically, want make div image fade in after delay, after rest of page has loaded. of page load, there delay, image fade in. here code. doesn't seem working. $(window).load(function() { // $(document).ready shorthand $('.contentrightcopy').delay(i * 400).fadein(2000); }); fixed problem. works fine now. added... display: none; to css of .contentrightcopy added javascript. $(window).load(function() { $('.contentrightcopy').delay(2000).fadein(2000) })

types - Dynamic Primitive in Objective-C -

i have value stored as uint64_t (the maximum needed app). need integer math number, size depends on user specifies. i need function takes uint64_t , bit-size casts proper primitive , returns it. @interface eaeintegervalue : nsobject <nscopying> @property uint64_t storageobject; - (id)init; - (id)initwithvalue:(uint64_t)value; - (uint64_t)getvalueuint64t; - (int64_t)getvalueint64t; - (uint32_t)getvalueuint32t; - (int32_t)getvalueint32t; - (uint16_t)getvalueuint16t; - (int16_t)getvalueint16t; - (uint8_t)getvalueuint8t; - (int8_t)getvalueint8t; // function concerned with: - (id)getvalue:(uint8_t)bitsize; @end pseudocode getvalue: - (id)getvalue:(uint8_t)bitsize { if (bitsize == 8) return [self getvalueint8t]; if (bitsize == 16) return [self getvalueint16t]; if (bitsize == 32) return [self getvalueint32t]; if (bitsize == 64) return [self getvalueint64t]; //...unsigned... @throw... } i getting complaint returning primitive id. understand why er

c# - Exception filter not working in web api -

i have custom exception filter capable handle errors in controller( common error handling mechanism) , public class exceptionhandlingattribute : exceptionfilterattribute { public override void onexception(httpactionexecutedcontext actionexecutedcontext) { var error = actionexecutedcontext.exception; if (error bussinessexcetion) { var exceptionbase = (bussinessexcetion)error; var code = (httpstatuscode)exceptionbase.httpexceptioncode; throw new httpresponseexception(new httpresponsemessage(code) { content = new stringcontent(exceptionbase.message), reasonphrase = "exception" , }); }

html - Width and text-align property -

why text-align , width not applying inline element. jsfiddle example. can prooflink css spec? width 10.3.1 inline, non-replaced elements the 'width' property not apply . computed value of 'auto' 'margin-left' or 'margin-right' becomes used value of '0'. text-align 16.2 alignment: 'text-align' property value: left | right | center | justify | inherit initial: nameless value acts 'left' if 'direction' 'ltr', 'right' if 'direction' 'rtl' applies to: block containers inherited: yes percentages: n/a media: visual computed value: initial value or specified quotes css 2.1 specification.

android - Awesome Errors with date wheel picker? -

i have problem date wheel picker. has change date specific month. in 30, february doesn't have 28 days. in 31, months change 31. days, works pretty well.(eg. in emulator date 1-2-2014, work yesterday, emulator date 31-1-2014, months 31.) , problem, in jun 30, february doesn't have 28.what should do, give me advices. package com.example.aa; import java.util.arraylist; import java.util.calendar; import java.util.list; import android.app.dialog; import android.content.context; import android.graphics.typeface; import android.util.log; import android.view.view; import android.view.viewgroup; import android.view.window; import android.widget.button; import android.widget.linearlayout; import android.widget.tablelayout.layoutparams; import android.widget.textview; import kankan.wheel.widget.adapters.arraywheeladapter; import kankan.wheel.widget.adapters.numericwheeladapter; import kankan.wheel.widget.onwheelchangedlistener; import kankan.wheel.widget.wheelview; public cl

Google App Engine PHP File Upload Broken -

zend 1.9 project, using code right docs/examples php environment. image upload used work well, i'm getting: php fatal error: call undefined method google\appengine\api \cloud_storage \cloudstoragetools::parsefilename() in /base/data/home/runtimes /php/sdk/google/appengine/ext /cloud_storage_streams /cloudstoragestreamwrapper.php on line 143 sounds it's out of code's hands, no?! ideas? i've posted question on https://groups.google.com/forum/#!topic/google-appengine/rjmzxn8qtem boards seem bit dead... after updating php sdk locally, seems work. (i'm not sure why is, though, sdk use locally doesn't referenced on production. assumed libraries auto loaded on live servers, although classes uploaded along app. weird...)

php - SQLite2 database conversion -

so far examples of converting sqlite2 database sqlite3 or mysql answers assume person has access on computer tools needed conversion or access specific folders on webserver host. can give working answer allow using web host on shared server convert or export contents of sqlite2 database sqlite3 or mysql database please? i have webserver on pc , php version of php have not support sqlite2 stuck because have use particular version of php webserver, can't swap out version, options appear doing conversion on webserver. help in solving issue appreciated. you don't need php convert database. download: sqlite 2.8 https://www.sqlite.org/sqlite-2_8_17.zip sqlite 3.2 https://www.sqlite.org/2013/sqlite-shell-win32-x86-3080200.zip decompress both in folder. assuming db file called old.db , put in same folder 2 executables, navigate folder cmd.exe , run following command: sqlite old.db .dump | sqlite3 new.db as recommended in sqlite 3.x announcement . new.db

using python how to read only the first line of ping results? -

how read first line of ping results using python? on reading ping results python returns multiple lines. know how read , save 1st line of output? code should not work ping should work tools "ifstat" too, again returns multiple line results. run command using subprocess.check_output, , return first of splitlines(): import subprocess subprocess.check_output(['ping', '-c1', '192.168.0.1']).splitlines()[0] andreas

java - How do I insert last_insert_id using preparedStatement? -

i facing difficulty in inserting " last_insert_id" in prepared statement.i got how select last_insert_id in prepared statement below: preparedstatement getlastinsertid = con.preparestatement("select last_insert_id()"); when use same procedure inserting last_insert_id in preparedstatement this: 1. preparedstatement pst = con.preparestatement("insert introducer_table values(?,?,?,?)"); 2. 3. //introducer details database 4. pst.setstring(1,last_insert_id()); 5. pst.setstring(2, nameofintroducer); 6. pst.setstring(3, accountno); 7. pst.setstring(4, signofintroducer); im getting 'null' value in first column.can 1 me come out problem if doing both save actions @ time use getgeneratedkeys() , it's pretty java. i'm not sql guru, here found way generated id using getgeneratedkeys() long generatedid= 0l; statement = con .getconnection() .preparestatement(

cocoa - CALayer is not clear when drawing -

Image
i use calayer make tab bar. sometimes, drawing not clear can see 'index.pgiu'. if see on retina display, more worse usual screen. (see difference between 'index.pgiu' , 'flow' label ) how can fix it? cannot find keyword google. answer. [[nsscreen mainscreen] backingscalefactor]

c# - For Good coding practice, do we still have to validate data again in method2 if we already validated in method1 & method1 passes that data to method2? -

let have public void method1(){ string s1=""; string s1=gettext(); if(myvalidation.isok(s1)){ dosomethingwith s1 here method2(s1); } } public void method1(string s1){ if(myvalidation.isok(s1)){ // need line of code?? //do } } for coding practice, do still have validate data again in method2 if validated in method1 & method1 passes data method2? you should refactor code isolate internal methods assume data exposed public methods execute validation on external inputs. of course, if screw data in internal methods problem public void method1(){ string s1=""; string s1=gettext(); if(myvalidation.isok(s1)){ runsomethinginternalformethod1(s1); // or // if(runsomethinginternalformethod1(s1)) // runsomethinginternalformethod2(s1); } } public void method2(string s1){ if(myvalidation.isok(s1)){ runsomethinginternalformethod2(s1); } }