Posts

Showing posts from June, 2010

statistics - Running Ordinal Logistic Regressions with Proc Surveylogistic -

i running ordinal logistic regression. problem sas won't let me specify value in dependent categorical variable reference. my code looks like: proc surveylogistic data=mydata; weight mywgt; strata mystrata; domain mydomain; class depvar (ref="myref") indvar1 (ref="myref1") indvar2 (ref="myref2") /param=ref; model depvar (order=internal)=indvar1 indvar2; title 'my model';run; in class statement specify want "myref" reference dependent var means when @ parameter estimates intercepts value "myref" should omitted. when @ response profile, sas correctly orders categories dependent var, no matter put in class or model statement, keep getting highest value reference dependent var. does know how can specify reference dependent var? occurred me change order category want reference have highest value, wouldn't ordered correctly ordinal logistic regression inappropriate. thanks use event= specify ref in depe

php - Getting / adding eloquent models to cache -

i've started dig laravel 5 , i'm "digging" it. (heh, heh, it? ... sorry.) anyways. in code, noticed that, relationships, eloquent ton of queries retrieve said relationships, or load them. i'm attempting cache results of these relationships, (hopefully), can reduce number of queries down little, , instead pull cache. in earlier versions of laravel, know possible run user::with('stuff')->remember(5)->get() , retrieve results , cache them automatically. however, seen under eloquent caching section in laravel's upgrade guide , that's no longer possible. my question is, how should 1 go achieving model caching now? i'd cache either parent relations, or (preferably), individual models themselves, , check cache them before pulling. looked adding event listener queries via event::listen('illuminate.query') check cache before querying database, don't know how return result listener. i feel i'm on right path here i'm

formatting - Printf not functioning properly in Java 1.7 -

i'm doing assignment school requires program users personal information through various methods(last name, first name, address, etc.) , output them through main method. problem: printf statement works fine when displaying name, when displays rest of users information, won't format properly. import java.util.scanner; public class personalinfo { public static string lastname, firstname, address, email, phone; public static scanner kb = new scanner(system.in); public static void main(string[] args) { getlastname(); getfirstname(); getaddress(); getemail(); getphone(); displayname(); displayaddress(); displayemailphone(); } //--------get methods-------- public static void getlastname() { system.out.print("what last name of user? "); lastname = kb.nextline(); } public static void getfirstname() { system.out.print("now enter first name: "); firstname = kb.nextline(); } public static void getadd

c# - How to find the logged in user in Sharepoint? -

i have developed "web part" has deployed on sharepoint server. need username of user, has logged in sharepoint server within web part. how username? following worked me: spweb thesite = spcontrol.getcontextweb(context); spuser theuser = thesite.currentuser; string strusername = theuser.loginname; and check this out.

sqlite - Android delete all rows or update and remove old? -

i need store list of contacts web server in android app. android data copy of web server , contacts have no foreign keys , table. i'm thinking of updating android data on periodic basis. i'm wondering method best update data, i'm thinking of: delete rows table , insert data web server update rows match webserver , delete weren't updated. which method better in terms of performance? this have done before when working on project: first, truncating entire table , doing fresh storage database in app depends on size of data syncing down. obviously, fine delete if size small. the solution used have column in remote server (corresponding table) when contact item deleted, update deleted timestamp or [deleted]. when syncing down phone, check see sync items not deleted or updated/new.or sync down contacts json field [deleted : true] once in android code, check see if [deleted == true] , consequently delete contact item local db. loop through list store n

java - Local SMTP server for ubuntu -

i'm using java class sends mails using javamail. need use though authentication not yet implemented. has smtp hostname, port, from, to, subject , body. i need smtp server it. of ones i've tried use authentication. know maybe local smtp server ubuntu? doesn't have complex/secure because it's proof of concept. something sending text email gmail account yahoo account. thanks

debugging - Reference - What does this error mean in PHP? -

what this? this number of answers warnings, errors , notices might encounter while programming php , have no clue how fix. community wiki, invited participate in adding , maintaining list. why this? questions "headers sent" or "calling member of non-object" pop on stack overflow. root cause of questions same. answers questions typically repeat them , show op line change in his/her particular case. these answers not add value site because apply op's particular code. other users having same error can not read solution out of because localized. sad, because once understood root cause, fixing error trivial. hence, list tries explain solution in general way apply. what should here? if question has been marked duplicate of this, please find error message below , apply fix code. answers contain further links investigate in case shouldn't clear general answer alone. if want contribute, please add "favorite" error message, warning or notic

arrays - Java - Class Data Type - Sorting Problems -

assume have implemented class edge has 4 attributes, of of type int: from to quality length . in program , have created edge[] array. i want implement 2 sorting parameters - one of them sort edge array in descending order of qualities , the other sort based on increasing order of lengths . i needing these 2 orderings in distinct parts of code. i using library function arrays.sort() sorting. the way know of sorting class data type arrays implement compareto() within class edge works 1 parameter(quality or length not both). how can implement 2 sorting functions(2 compareto() functions ?) , decide 1 called during sorting? in c++ , can make many compare functions , state function go through.how achieve in java? note: goal sort array of datatype edge using arrays.sort() , , use 2 different parameters sorting , decide 1 used @ point. in java, can create 2 classes implements comparator , defining compare method, 1 each of sort orders desire. then ca

php - Laravel Fzaninotto Faker Seed File: [ErrorException] copy(): The first argument to copy() function cannot be a directory -

i want create files seedfile using fzaninotto/faker. file($sourcedir = '/tmp', $targetdir = '/tmp') // '/path/to/targetdir/13b73edae8443990be1aa8f1a483bc27.jpg' file($sourcedir, $targetdir, false) // '13b73edae8443990be1aa8f1a483bc27.jpg' my seedfile files looks this: $factory('app\file', [ 'order_id' => 'factory:app\order', 'originalfilename' => $faker->file(public_path('files/uploads'), public_path('files/uploads/tmp'), false), 'filename' => $faker->randomnumber($nbdigits = null), 'filepath' => 'files/uploads' ]); and have public folder structure looks this: public -files -uploads -tmp <- here dummy files of mine can used fzaninotto fakers dummy creation class how structure seedfile correctly, able generate dummy files? accidentally hat source directory target directory. wo

python - Convert(decode) hex string to ASCII or any other understandable format -

b'7668647866696c654d006900630072006f0073006f00660074002000570069006e0064006f0077007300200036002e0033002e0039003600300030002e003100370033003900360000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' i want convert hex string ascii or readable text. getting block system image file. expanding on joran's answer, import string data = bytes.fromhex(b'7668647866696c654d006900630072006f0073006f00660074002000570069006e0064006f0077007300200036002e0033002e0039003600300030002e003100370033003900360000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

ruby on rails - How to split the file path of my head point gets changes? -

i want split file path according occurance of head point in file path. case 1: puts fileutils.pwd() output: "/home/myhome/bigproject/now_with_bugs_fixed/subfolder/" my project head bigproject . want split file path head point bigproject , want result as: /bigproject/now_with_bugs_fixed/subfolder/ case 2: puts fileutils.pwd() output: "/home/data/cloud/vz-hadoop/bigproject/now_with_bugs_fixed/subfolder/" now project head again bigproject but there little change in path.i want split file path head point bigproject , want result same in case 1: /bigproject/now_with_bugs_fixed/subfolder/ i want in ruby language.please don't use index numbers. > s = fileutils.pwd > s[s.index('/bigproject')..-1] => "/bigproject/now_with_bugs_fixed/subfolder/" or split: > s.split('myhome')[1] => "/bigproject/now_with_bugs_fixed/subfolder/" (or ton of other ways.) that said, sure want

python - Dict comprehension produces seemingly unwarranted NameError -

i'm using brian2 run neural-network simulations. in order record data during each simulation, i'm creating several instantiations of brian2 's spikemonitor class. want store these monitors in dict, created using dict comprehension. as test, execute following in interactive session: in [1]: import brian2 in [2]: pe_mt = brian2.poissongroup(1, 100 * brian2.hz) in [3]: record_pops = ['pe_mt'] in [4]: {'mon_' + pop: brian2.spikemonitor(eval(pop)) pop in record_pops} out[4]: {'mon_pe_mt': <spikemonitor, recording spikemonitor>} everything looks great. when move code following function def test_record(): pe_mt = brian2.poissongroup(1, 100 * brian2.hz) record_pops = ['pe_mt'] return {'mon_' + pop: brian2.spikemonitor(eval(pop)) pop in record_pops} and call it, following error in [9]: tests.test_record() --------------------------------------------------------------------------- nameerror

java - Notify a Fragment of onPostExecute from MainActivity -

in android, i'm having trouble figuring out how, when asynctask complete, notify fragment listening. seems usual java stuff, propertychangelistener not available. in onpostexecute , want fire event , have otherfragment see that. how do this? public class mainactivity extends fragmentactivity { <stuff> private class consumewebservice extends asynctask <string, // type of parameters sent task upon execution - doinbackground() integer, // type of progress units published during background computation -onprogressupdate() string> { public consumewebservice(somekindoflistener listener){ this.mylistener = listener; } protected string doinbackground(string... urls) { < json data restful service> < create , populate sqlite db wit json data> return jsondata;

android - Open installed application from application -

i have opencv color blob sample installed on device. have application button. when button pressed, trying call opencv color blob open, have had no success. have tried: public class mainactivity extends activity { public string packge_name = "org.opencv.samples.colorblobdetect"; public string class_name = "colorblobdetectionactivity"; button bt; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); bt = (button) findviewbyid(r.id.button1); } public void launchcall() { // todo auto-generated method stub intent intent = new intent(); intent.setaction(intent.action_main); intent.addcategory(intent.category_launcher); intent.setcomponent(new componentname(packge_name, class_name)); startactivity(intent); } } then have xml <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns

How do I list all of the sub directories in C#? -

this question has answer here: how recursively list files in directory in c#? 15 answers i have directory 30 sub directory files in "c:\school\grad school (comp sci)\thesis\apps" . how list of sub directories in srcml.net ? [testcase] public void calculatesimpleprojectstats() { var dataproject = new dataproject<completeworkingset>("android apps", path.getfullpath(@"c:\school\grad school (comp sci)\thesis\apps\accelerometer-app-master"), "..//..//..//srcml"); debug.writeline("parsing android-pedometer-studio...."); dataproject.updateasync().wait(); namespacedefinition globalnamespace; assert.that(dataproject.workingset.tryobtainreadlock(5000, out globalnamespace)); displaysensortypes(globalnamespace); //displaywhetherappisunittested(); displaycallsto

objective c - Embedd HTML5 inside native iOS Application -

i searching way extend native ios app (written in objective-c) html5/css/js so write parts of app´s code in html basic shop or similar code in html exists. but don´t want destroy great native , feel or make users think left app , entered scaled-down version of safari or similar. won´t feel on external html on net. i want html page inside app full advantages of device animations, transitions, preloading, no borders. maybe make use of device functions accessing camera, sound , on. how done if possible? thanks in advance you explore uiwebview https://developer.apple.com/library/ios/documentation/uikit/reference/uiwebview_class/ though offhand not sure if supports hoping in terms of animation/etc.

html - CSS float container doesn't wrap around it's children, clearing the children doesn't work -

why doesn't div class "items" wrap around "item"s? applying clear: both children doesn't help. section not wrap around "item"s. .items { background: #ff0; width: 1000px; display: block; } .item1, .item2, .item3 { width: 290px; height: 350px; float: left; margin-left: 23px; margin-top: 80px; background-color: #cbcbcb; } <section> <div class="items"> <div class="item1"> <h3>php testing</h3> </div> <div class="item2"> <h3>jquery testing</h3> </div> <div class="item3"> <h3>another one</h3> </div> </div> </section> or try .items{overflow:hidden}

osx - How do you set the terminal tab title from Node.js? -

i'm aware can done manually terminal using: echo -n -e "\033]0;my terminal tab title\007" i tried putting console.log , process.stdout.write , fiddling escaping, can't work. to save reading bit of time, here function in strict mode: function setterminaltitle(title) { process.stdout.write( string.fromcharcode(27) + "]0;" + title + string.fromcharcode(7) ); }

boolean - Creating a truth table for any expression in Python -

i attempting create program when run ask boolean expression, variables , create truth table whatever entered. need use class , have far. not sure go here. from itertools import product class boolean(object): def __init__(self, statement, vars): self.exp = statement self.vars = vars def __call__(self, statement, vars): def main(): expression = raw_input('give expression:') vars = raw_input('give names of variables:') variables = vars.split(' ') b = boolean(expression, variables) if __name__ == "__main__": main() i have library want! check out github repo or find here on pypi. the readme describes how works, here's quick example: from truths import truths print truths(['a', 'b', 'x', 'd'], ['(a , b)', 'a , b or x', 'a , (b or x) or d']) +---+---+---+---+-----------+--------------+---------------------+ | | b | x | d | (

Historical data for commodities using Yahoo Finance API -

i desperately trying find source of historical data various commodities. don’t need charts, need values – example closing price of corn jul 15 (cn15.cbt) last month. i’ve tried on yahoo finance, there’s nothing there, no historical data. found out yahoo finance api , tried use that: http://www.jarloo.com/yahoo_finance/ no luck either. best solution me know code use yahoo finance api historical data commodities it. if direct me website values every day of last few months commodity great too. able help, please? thank you petr

python - re.search() logically or two patterns in re.search() -

i have following string. page load http://xxxx?roxy=www.yahoo.com&sendto=https://mywebsite?ent took 4001 ms (ne: 167 ms, se: 2509 ms, xe: 1325 ms)<br><br><br>topic: yahoo!! website website | mywebsite<br> or page load http://xxxx?roxy=www.yahoo.com&sendto=https://mywebsite?ent took long (12343 ms ne: 167 ms, se: 2509 ms, xe: 1325 ms)<br><br><br>topic: yahoo!! website website | mywebsite<br> i want extract 4001 or 12343 above ent took 4001 ms or ent took long (12343 ms , assign variable tt = int(re.search(r"\?ent\s*took\s*(\d+)",message).group(1)) this regex match first part , return me 4001.how logcially or expression r"\?ent\s*\took\s*too\s*long\s*\((\d+)" extract 12343 second part? this 1 matches both patterns in 1 go , extracts desired number: tt = int(re.search(r"\?ent took (too long \()?(?p<num>\d+)",message).group('num'))

html - Python form drop down options populated by sql -

this first post. new programming. attempting build html form in python contains drop down. drop down options, have hard coded, want populate options sql, dynamically changing if database updated options. must mention drop down being used search/filter data table populated database. please suggestions. hard coded dropdown: <div class="dropdown col-lg-2"> <label for="form_status" id="form_status">status</label> <select class="form-control input-sm" id="form_status" name="form_status"> <option {% if var_status == ""%}selected="selected"{% endif %} value=""></option> <option {% if var_status == "1001"%}selected="selected"{% endif %} value="1001">active</option> <option {% if var_status == "1018"%}selected="selected"{% endif %} value="1018">obsolete</op

Mock external server during integration testing with Spring -

i have spring web server on request makes external call third-party web api (e.g. retreive facebook oauth token). after getting data call computes response: @restcontroller public class hellocontroller { @requestmapping("/hello_to_facebook") public string hello_to_facebook() { // ask facebook httpget httpget = new httpget(builduri("https", "graph.facebook.com", "/oauth/access_token")); string response = httpclient.execute(httpget).getentity().tostring(); // .. response return response; } } i'm writing integration test checks hitting url on server leads expected result. want mock external server locally don't need internet access test this. best way this? i'm novice in spring, have far. @runwith(springjunit4classrunner.class) @springapplicationconfiguration(classes = application.class) @webappconfiguration @integrationtest({}) public class testhellocontrollerit {

java - Parse double value and set in TextView -

Image
for parse data use retrofit (gson) library . have problems parsing double value 'position' . full json can see here below. parse string array 'words' great double value have nothing in textview. can wrong , need fix , missed? thanks help! json mainactivity.java w3wnetworkfactory.w3wgetinstance().w3wgetapicall().getposition(w3w_api_key, new words("gliders.inquest.hardly"), new callback<positionresponse>() { @override public void success(positionresponse positionresponse, response response) { position_w3w.settext(arrays.tostring(positionresponse.getposition()).replaceall("\\[|\\]", "")); //log.d("w3w location: ", arrays.tostring(positionresponse.getposition())); string mlatlng = arrays.tostring(positionresponse.getposition()).replaceall("\\[|\\]", ""); //convert string double double value =

xpages - How to output rich text (html) field content when outputting to PDF using Apache FOP -

i trying generate pdf file using xagent , apache fop suggested stephen wissel here: http://www.wissel.net/blog/d6plinks/shwl-8tnltv . of process working fine, xagent called, creates xml document , passes through transform output pdf. stuck on how handle rich text fields. fields contain user-generated content (created in xpage) , contain html fragments. has come way output rich text fields along other content pdf? rich richtext [insert unprintable]. there number of considerations: do require richtext in full client beauty (tabbed tables, ole, sections, hovers etc.)? is html representation of richtext enough (the 1 when @ through browser - enriched appsfidelity )? in former case avenue grab dxl representation , try convert 1 - played that, seems feasible long , painful road. in later case, first hands on html representation. can done using ?openfield command or code snipped mark . now have html, might want cleanup using jsoup , convert 1 xsl:fo. guidance can

java - A Scalable Architecture for Reconstructing events -

i have been tasked develop architecture data transformation pipeline. essentially, data comes in @ 1 end , routed through various internal systems acquiring different forms before ending in destination. the main objectives - fault tolerant . message should recoverable if 1 of intermediate systems down. replay/ resequence - message can replayed stage , should possible recreate events in idempotent manner. i have few custom solutions in mind address implement checkpoint system message can logged @ both entry , exit points @ each checkpoint know failure happens. implement recovery mechanism can go logged storage ( database, log file etc.. ) , reconstruct events programmatically. however, have feeling standard problem defined solutions. so, welcome thoughts on suitable architecture go with, tools/packages/patterns refer etc.. thanks akka obvious choice. of course scala version more powerful, java bindings can achieve lot. i think can fo

Synchronize PHP and MySQL Timezones -

my timezone through php umt using code: $timezone = date_default_timezone_get(); // utc echo "the current server timezone is: " . $timezone."<br />"; echo date('y-m-d h:i:s'); // 2015-04-10 00:08:05 and mysql gives me pkt system timezone , time 2015-04-10 05:14:38 select @ @system_time_zone // pkt select now( ) , unix_timestamp( now( ) ) // 2015-04-10 05:14:38 due time difference, unable fetch correct records database using php. how can synchronize php , mysql timezones both both return same time? is possible change timezone of mysql using php? i have tried this , i'm getting error: warning: pdo::__construct(): server requested authentication method unknown client you can use mysql's function convert_tz(timestamp_field,[mysql_timezone],[php_timezone]) or change servers timezone in php: date_default_timezone_set([timezone]); php date_default_timezone_set or change mysql timezone: set global time_zone

Serializing java.util.Random -

i'm working on small, simple game (mostly learn what's new in java 8 , javafx). 1 of features have ability seed game's random number generator can play same game friend on different system ( think minecraft maps or the binding of isaac games ). i add ability save game resumed @ later time. after looking on documentation java.util.random class, can't find way current seed of random number generator. ways have come restore random number generator after saving game either access seed via reflection @ save time , use that, or seed initial seed @ load time , call nextint() on , on again until we've rolled forward random number generator enough before game saved. first of all, @user2357112 points out, random implements serializable , , writing seed field (along nextnextgaussian , havenextnextgaussian fields). have tried serializing it? should 'just work'™. other serializers, gson, work. gson.fromjson(gson.tojson(r), random.class); retur

OpenLayers 3 - How can I abort pending ajax requests - ol.source.GeoJSON -

i'm adding layer source requested ol.source.geojson on moveend. how can abort pending ajax requests if map panned again before request finishes? map.on('moveend', function(){ map.removelayer(highlightedlayer); var thesource = new ol.source.geojson({ url: 'wfs.php?bbox='+bbox }); var highlightedsource = new ol.source.geojson({}); thesource.on('change', function(e){ if(thesource.getstate() == 'ready'){ var features = thesource.getfeatures(); $.each(features, function(k,v){ if(v.n.filter == 'include'){ highlightedsource.addfeature(features[k]); } }); highlightedlayer.setsource(highlightedsource); map.addlayer(highlightedlayer); } }); }); in

vb.net - Animate Picturebox in VB -

i new vb , can't figure out how animate button using mousehover event.. i want create single loop buttons(picturebox) in project increase button's size when user rests mouse on it. maybe like: for each form form in application.openforms each control control in form.controls tks. appreciated. use inherits create new button (or picturebox) class purpose. here code. public class cutebutton inherits system.windows.forms.button protected overrides sub onmousehover(e eventargs) ' 'wite code here change button size or whatever. ' mybase.onmousehover(e) end sub end class

android - Unit Testing ActiveAndroid Models Using Robolectric -

i using activeandroid of models, , wanted start unit testing work. unfortunately, getting load of errors, namely in being unable initialize activeandroid using proper context. activeandroid iniatilized: activeandroid.initialize(context) i have tried initialize context by: have stub class extends application, , use initialize db. private class testapp extends com.activeandroid.app.application{ @override public void oncreate() { super.oncreate(); initialisedb(getdatabasename()); } protected string getdatabasename() { return "sad"; } private void initialisedb(string dbname) { activeandroid.initialize(this); } } this fails, class return null .getpackagename() , .getapplicationcontext(), both of used internally initialize. i have tried using shadowcontextwrapper, may using wrong. here how went it: shadowcontextwrapper shadowcontextwrapper = new shadowcontextwrapper(); shadowcontextwrapper.setapplicationname

jsf 2 - <p:autoComplete> Uncaught TypeError: Cannot read property 'keyCode' of undefined -

this question has answer here: adding jquery primefaces results in uncaught typeerror on place 1 answer i'm trying use <p:autocomplete /> of primefaces 5.1, reason when load page receive folowing message on browsers console: uncaught typeerror: cannot read property 'keycode' of undefined my view this: <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:p="http://primefaces.org/ui"> <h:outputscript library="primefaces" name="jquery/jquery.js"/> <h:outputscript library="primefaces" name="jquery/jquery-plugins.js"/> <ui:composition> <div class="navbar navbar-inverse navbar-fixed-top&

centos - MySQL doesn't use the options in my.cnf -

i use virtual machine centos on work. able work it's mysql 5.6 without trouble, virtual machine cloned (literally cloned) create 1 on same server. since then, original virtual machine not use options defined on [mysqld] /etc/my.cnf file. i'm trying change server-id option of machines can set db replication on them, problem persists on both machines (and replication can't set server-id=0, default value it's assuming). obs: before machine cloned, had no problems @ , succeeded create replication between original vm , computer. any thoughts?

java - Is this a class, constructor, or method? -

this question has answer here: methods vs constructors in java 9 answers i'm having trouble identifying is. @ point, familiar methods, constructors, , class declarations like. this? why constructor , method had baby? public polygon polygonfrom(point[] corners) { // method body goes here } what have method why? in java, method declarations have 5 components, in order: modifiers—such public , private , , others learn later. the return type—the data type of value returned method, or void if method not return value. the method name—the rules field names apply method names well, convention little different. the parameter list in parenthesis—a comma-delimited list of input parameters, preceded data types, enclosed parentheses, () . if there no parameters, must use empty parentheses. the method body, enclosed between braces—the method's code

error handling - I can't seem to figure out how to fix two lints in my javascript. Can someone help me understand? -

i started javascript , made first game today! happy , in process of making lint free. i'm getting frustrated, fixed mistakes(lints) there 2 can't seem fix! i've been trying on hour. please me solve this? i'm getting frustrated :( the lints are: 5 'prompt' used before defined. var name = prompt("hallo speler, wat uw naam?.", "naam van speler"); 5 expected identifier , instead saw '"'. var name = prompt("hallo speler, wat uw naam?.", "naam van speler"); this javascript code: //schrijft functie begin spel. value van de input wordt een string. opnieuw knop wordt disabled. var name = prompt("hallo speler, wat uw naam?.", "naam van speler"); var data = [ [0, 11, "een hele goede morgen,"], [12, 17, "goede middag,"], [18, 24, "goede avond"] ], hr = new date().gethours(); (var = 0; < data.le

ios - Restkit response descriptor not work when keyPath with url query params -

i have keypath api/v1.2/comment?pid=:pid&text=:text and call api method through restkit rkobjectrequestoperation *operation = [self appropriateobjectrequestoperationwithobject:nil method:rkrequestmethodpost path:path parameters:nil]; operation.queuepriority = nsoperationqueuepriorityveryhigh; [operation setcompletionblockwithsuccess:success failure:failure]; [self.objectmanager enqueueobjectrequestoperation:operation]; where path replaced full complete url like http://localhost/api/v1.2/comment?pid=1&text=testing also have response descriptor path api/v1.2/comment?pid=:pid&text=:text but restkit tells can't found response descriptor path. in current version of restkit (at time of writing) query parameters aren't used response descriptor matching. remove them path pattern on response descriptor. if need query parameters mapping use @metadata.

sql - If a column has a default, is a NOT NULL constraint redundant? -

for example... create table phone ( id integer primary key, country_code integer not null default 1, area_code integer not null, number integer not null ); can safely remove not null country_code ? it's messing orm's validation thinks country_code must defined. no. default value used when don't set value. if remove not null constraint, have initial value, still manually set null .

javascript - Issue with multiple Synchronous ajax calls -

i need fire synchronous ajax calls consecutively. after each call i'm updating dom element . now issue occurs,the element gets updated when calls finished. var xmlhttp = new xmlhttprequest(); xmlhttp.open("get", "analysis.py?id="+id, false); xmlhttp.send(); document.getelementbyid("res").innerhtml = "done id "+id; id+=10; xmlhttp = new xmlhttprequest(); xmlhttp.open("get", "analysis.py?id="+id, false); xmlhttp.send(); document.getelementbyid("res").innerhtml = document.getelementbyid("res").innerhtml+"done id "+id; the element dom shows : done id 1done id 11 @ once instead of 1 after expected i.e. element directly updated @ end of both calls. edit 1: hi guys, found issue code. following code runs first ajax, after ajax calls seem run work defined in analysis.py not done these calls. var total = %d; function filldatabase(){ var id = 1; callajax(id); } function call

multithreading - Python -- switched from Threading to Multiprocessing, now publish/subscribe (Louie) doesn't work -

i switched of threading implementations multiprocessing today , went great -- except louie dispatcher messages. granted, that's not latest publish/subscribe module, use because have use python-openzwave. imagine has messages not being able sent across processes. question is, there way louie? if not -- there publish/subscribe message module allows it? thanks. edit, asked post code: for example, here process continually runs in background , performs computer/network/security checks: the call start check class: _ = utilities.environment() the environment class (just init , main function): class environment(object): def __init__(self): self.logger = logging.getlogger(genconfig.logger_name) self.process = multiprocessing.process(target=self.run_tests) self.process.daemon = true self.process.start() def run_tests(self): self.zwavereceived = false while true: self.comp_test() self.net_te

c# - Cross-thread operation -

i’m doing stuffs in thread , i’m try access label property, can’t set property value. lbldisplay.visible = true; i’m getting error on this. error - cross-thread operation not valid: control 'lbldisplay' accessed thread other thread created on. in advance. you can’t directly access thread other thread created on. can set property value using methodinvoker. lbldisplay.invoke((methodinvoker)(() => { lbldisplay.visible = true; })); this way need access control in different thread.

mongodb - Mongo-Hadoop streaming -

i'm new mongodb , hadoop. i'm trying access mongodb data input hadoop mapreduce job. don't quite know how specify collection use data from. tried: hadoop jar/usr/local/cellar/hadoop/2.6.0/libexec/share/hadoop/tools/lib/hadoop-streaming-2.6.0.jar -input user/test/input/ -output user/test/output/ -inputformat com.mongodb.hadoop.mapred.mongoinputformat -outputformat com.mongodb.hadoop.mapred.mongooutputformat -io mongodb -d mongo.input.uri=mongodb://localhost/my_dbs.collectionname -d stream.io.identifier.resolver.class=com.mongodb.hadoop.streaming.io.mongoidentifierresolver -mapper /users/wordcountmapper.py -reducer /users/wordcountreducer.py -libjars /usr/local/cellar/hadoop/2.6.0/libexec/share/hadoop/tools/lib/mongo-hadoop-streaming.jar but following error: error streaming.streamjob: unrecognized option: -d usage: $hadoop_prefix/bin/hadoop jar hadoop-streaming.jar [options] and when tried this, error: hadoop jar /usr/local/cellar/hadoop/2.6.0/libexec/shar

booth multiplier error in verilog -

i have written module booth(num1,num2,prod); input [22:0] num1,num2; output [45:0] prod; reg[22:0]num1_bar; reg[46:0]sub_1; reg [22:0]temp; reg [2:0]sel; reg [22:0]add; reg [22:0]result; reg [22:0]temp2; @* begin temp = ~ num1; num1_bar = temp + 'b00000000000000000000001; sub_1 = {'b00000000000000000000000, num2, 1'b0}; end integer i; @* begin for( = 0; < 22; = i+1) begin sel = sub_1[2:0]; if(sel == 2'b10) begin add = sub_1[46:24] + num1_bar; sub_1 ={add[22],add,sub_1[23:1]}; end else if(sel == 2'b01) begin add = sub_1[46:24] + num1 ; sub_1 ={add[22],add,sub_1[23:1]}; end else begin sub_1= {sub_1[46] ,sub_1[46:1]}; end end temp2 = ~ sub_1[24:1]; result = 23'b00000000000000000000001 + temp2; prod <= result; end endmodule i have written above code 23*23 booth multiplier, have got errors in code. p

css - How to just show hamburger icon of menu not the background bar and have the menu options in top-middle? -

i have menu following have issues it. example, in full size screen menu options not in middle-top of section located in. issue not know how remove black bar when screen in cell phone size , hamburger icon visible. demo <!doctype html> <html lang="en"> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"> <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script> </head> <body> <header> <div class="container-fluid"> <div class="row"> <div class="container"> <div class="row"> <div class=" col-md-12 col-sm-12 col-xs-12 search-container">

C++ Class Composition: Constructor? or ()operator? -

i writing code book exercise , ran simple question. best if show examples first. first class: fclass heaader class fclass { public: explicit fclass( int = 0, int = 0 ); fclass& operator()( int, int ); void print(); private: int x; int y; } first class: fclass cpp fclass::fclass( int a, int b ) : x(a), y(b) { } fclass& fclass::operator()( int a, int b ) { x = a; y = b; } void fclass::print() { cout << "x: " << x << "\ny: " << y << endl; } second class, sclass.h class sclass { public: explicit sclass( int = 0, int = 0 ); void print(); private: fclass firstclass; } second class, sclass.cpp sclass::sclass( int a, int b ) : firstclass( a, b ) { } void sclass::print() { firstclass.print(); } the main function int main() { sclass secondclass( 1, 2 ); secondclass.print(); } now question when deleted operator() function in fclass. code still worked! understan