Posts

Showing posts from February, 2013

mysql - updating rows instead of creating new entries database android -

i have been working on recipe android recipe book utilize database storing events. current code allows me add new entries unable modify of added entries. need database predefined number of rows(48) functionality of updating these rows through corresponding edittext fields. can me modify following code achieve please? new android coding , need start database. here mydb file: package com.cookbook.data; import android.content.contentvalues; import android.content.context; import android.database.cursor; import android.database.sqlite.sqlitedatabase; import android.database.sqlite.sqliteexception; import android.util.log; public class mydb { private sqlitedatabase db; private final context context; private final mydbhelper dbhelper; // initializes mydbhelper instance public mydb(context c){ context = c; dbhelper = new mydbhelper(context, constants.database_name, null, constants.database_version);

java - How can I create an instance from a own class in FreeMarker (FTL) -

i wish instantiate java class have defined in domain , want use ftl code in way, i'm getting error. <#assign myclassinstance = "com.domain.myclass"?new())> is possible? should change it? myclass doesn't implements templatemodel thanks! there's no built-in function instantiating arbitrary non- templatemodel classes... maybe there should setting allow ?new . anyway, can write templatemethodmodelex that, , can pull of commonly included/imported templates <#assign unrestrictednew = "com.example.unrestrictednewmethodmodel"?new()> (or put instance data-model or configuration shared variable) , can <#assign myclassinstance = unrestrictednew("com.domain.myclass")(arg1, arg2, argn)> in templates. there 2 tricky parts in implementing such templatemethodmodel . 1 resolving class name class , recommend env.getnewbuiltinclassresolver().resolve(classname, env, null) , env current freemarker.core.environment obje

list of list in instance of object (java) -

i have defined class 'student'. each instance of class has name , n*m preferences (which string). public class student { string firstname; list<list<string>> choice = new arraylist<list<string>>(); public student(string name1, list<list<string>> preference){ this.firstname = name1; this.choice.addall(preference); } } next, have list in each student object saved. list<student> students = new arraylist<student>(); now problem is, when save 1 student in list working fine. however, when add second student list preferences of first students overwritten. add , read data follow, list<list<string>> preferences = new arraylist<list<string>>(); list<string> preferences1 = new arraylist<string>(); list<string> preferences2 = new arraylist<string>(); // add first student preferences.clear(); preferences1.clear(); preferences2.clear(); preferences

How to identify day change in java -

i want know how can identifies if there date changes i.e. 23:59 00:00. using servlet. can using static string type variable , assign " dd " part of below returned date stamp , comparing on every request current " dd " date stamp. if both " dd " part not match sign of date change. there 1 static int type variable want reset zero increment till day change. private static string getdate() { simpledateformat customformat = new simpledateformat("hh:mm:ss dd-mm-yyyy"); return customformat.format(new date(system.currenttimemillis())); } but how can without comparing it, there better way it? thanks.

python - urlencode of json data -

originating different question of mine, trying find elegant solution in python code ( mongo php turns array strings ) i have valid json file, array of elements - "" (not single ') the following python code creates post request causes php json_decode fail $_post array looks so: [{u'amount': u'1 (14 ounce) can', u'name': u'black beans, drained', u'short_name': u'black beans'}, {u'amount': u'1 (8 ounce) jar', u'name': u'salsa', u'short_name': u'salsa'}] (with u'' in strings) the code created this: json_data = open(json_filename) elems = json.load(json_data) running_index=0 elem in elems: data = urlencode(elem) result = urllib2.urlopen(base_url,data) any elegant way make data "php ready"? elegant == other doing (which horrificly works): data = data.replace("u%27","%22") data = data.replace("%27","%22&

android - BroadcastReceiver doesn't work -

i added receiver in manifest <receiver android:name=".packagereceiver" android:enabled="true"> <intent-filter android:priority="100"> <action android:name="android.intent.action.package_added"/> <action android:name="android.intent.action.package_replaced"/> <data android:scheme="package"/> </intent-filter> </receiver> and broadcastreceiver public class packagereceiver extends broadcastreceiver{ @override public void onreceive(context context, intent intent) { log.e("noti", "sucess"); //start notification service intent = new intent(context, notificationservice.class); context.startservice(i); }} .. when install package, it's didn't work... this package don't have activity.(only service , resource) is problem? then.. how call broadcastreceiver in packag

c# - EF DbContext VS Session lifetime -

i'm using entity framework code first ecommerce website. want store basket in session. i'm using ninject manage lifecycle of dbcontext, , i've set scope of per request. my problem because lifetime of basket per session, lifetime of dbcontext per request - basket isn't attached each request's new dbcontext instance. i re-instantiate basket on each request, seems quite inefficient getting basket details every request. i reattach session's basket @ start of each request. seems best solution can see. what's recommended way deal scenario? i've found other questions / posts ask scope of dbcontext, , recommendations use ioc container use same dbcontext per request. i'm doing though - i've not found answer question how keep per-request dbcontext attached longer lifetime of entity in session state. the recommended way not store persistence objects in basket rather pocos (plain objects) that: can used show contents of basket effic

javascript - Ajax validate response data that is not an empty page -

i'm using ajax populate page (server side) fetch content , display in main window. not have problems ajax, lot of time reponse data empty page <html></html> . when check in console ->network->page.html , status code ok response headers http/1.1 200 ok pragma: no-cache refresh: 1; url= http://balbla.com/page.html connection: close content-type: text/html then in response tab - > <html></html> my question how can validate in success function data not empty html page, before running commands below, otherwise, end blank page. $.ajax({ type: "post", url: 'http://balbla.com/page.html', data: 'country=' + user_country, success: function(data) { $pagewrap.fadeout(1000, function() { $('link[href="css/main.css"]').attr('href', $css); $pagewrap.hide().html(data).fadein(500); $.getscript($scripts); }); }, error: function(xhr, textstatus, error) { ale

postgresql - postgres scheduler - external tool or inside settings? -

i have few functions need run every day @ time. there way schedule postgres? or have use external tool? one option have make use of pgagent. http://www.pgadmin.org/docs/1.8/pgagent.html

c - Terminal input serial commands, output Arduino Tx -

i of beginner in space i using arduino mega2560 , interfacing coin machine vending machine. coin machine runs on protocol called mdb (multi-drop bus) 9bit serial. use arduino ide not cater 9-bit serial. have therefore decided code using c , ubuntu 12.04. have come across usart setup function can bitbash 9bit mode. have installed avr-gcc avr-libc avrdude. the coin machine acts depending on serial data recieves. i.e reset needs read 100101010 rx (this random 9-bit number, not sure true number @ moment). example if recieves 10101111 on rx dispense coin of desired type etc. there various other commands ack,poll, etc. want send appropriate binary numbers out arduino's tx , coin machine's rx , try communication coin machine. this context main question more general (lets assume working in 8bit mode): a) how can type 8bit binary number (e.g 10111010) on terminal, , have number put on tx line of arduno. b) since mega2560 has 3 tx/rx modules, can tx 1 module , rx module, test

Is it possible to make a "php injection"? -

i'm building web application , i'm concern security. is way make "php injection", in same way possible make "sql injection" ? means client can send php code executed on server. until don't use "eval" function, "no" because when value $_get , $_post, data treated simple string... maybe don't see obvious attack. in general, not unless evaluate might parse , execute php. mentioned eval, there other functions have eval-like properties (e.g. preg_replace , if attacker manages inject /e modifier) or can otherwise allow unwanted levels of access (e.g. system() ). also, if attacker can upload file , interpreted php, can run php code. nginx can easily misconfigured in way allows attackers execute php code in image files. same goes getting web site include() code - possibly overwriting files uploads, or changing include() arguments point remote site (if not disabled in php.ini).

amazon web services - Logstash & Elasticsearch issues -

Image
i need pro figure issue es & logstash. i'm using elasticsearch 1.1.0 , logstash 1.4.0 push logs es & kibana . my servers located in aws ( master -> v.core (4) , ecu (8) , ram (15 gb) ) node same . my logstash configuration : i'm taking log files s3 , put locally in server after logstash take them , push them es cluster . logstash + kibana + es master (located in 1 server) files 12m size , have more 20,000 files. my es configuration (master) cluster.name: my-cluster-name node.name: my-node-name node.master: true node.data: true path.data: /path_to_data/data path.logs: /path_to_logs/logs es configuration (node) cluster.name: my-cluster-name (same name) node.name: my-node-name (another name) node.master: false (this node not master) node.data: true path.data: /path_to_data/data path.logs: /path_to_logs/logs for checking cluster status : http://master_ip:9200/_cluster/health this result : { "cluster_name": "es-cluster-onetagv

css - Do we need to use javascript to create a responsive layout? -

i made download of several free responsive layout (you can find them through google if you're curious) , see layout has @ least 1 or 2 javascript files. the question is: javascript essential create responsive layout? then, in reply question "no" , have possibility link free responsive layout made html , css, well, receive wonderfull big thank you. the whole point of responsive layouts can (and should) done css3 media queries only. however, can require clever html design, if want have slide-in menu (hint: :active can powerful when combined tabindex make otherwise "inert" element respond click events link) , many developers can't bothered that, when jquery readily available. so basically, yes, can make responsive layout css only. , if succeed, congratulations! javascript can used make things easier, in general if think need it, need rethink how you're doing things. unfortunately, have no links javascript-less responsive layouts you

CSS Transform Element -

Image
using css transform property, how can make button this: i've tried playing skew , rotate , rotate3d , perspective without luck. feels if need mathematician understand of these new properties you'll have fiddle rotating along 3 axes, , skewing. here's example: div { perspective: 200px; width: 150px; position: relative; color: white; line-height: 2.4; text-align: center; padding-left: 20px; } div::before { content: ''; z-index: -1; position: absolute; background: #7fc552; top: 0; right: 0; bottom: 0; left: 0; transform: skew(-9deg) rotatex(-22deg) rotatey(-21deg) rotatez(-9deg); /* firefox seems render pretty bad jagged edges. add transparent outline fix that. */ outline: 1px solid transparent; } here's live demo: http://codepen.io/josephsilber/pen/jvohk/

javascript - How to align text like a trapezoid? -

here sample html code <div style="width:100px;height:100px"> 12345 1234 1234 1234 123 12345 1234 1234 123 1234 12345 </div> and want effect this: 12345 1234 1234 1234 1234 123 12345 1234 1234 1234 123 1234 12345 or 12345 123 1234 1234 1234 12345 1234 1234 1234 123 12345 1234 1234 or 12345 1234 12345 1234 1234 235 12345 123 1234 1234 123 212 123 1234 12 1234 12345 i have tried using text-align result not expected. how can effect without adding many of <br> , $nbsp , or adding many of <div style="margin..."> hard code? thanks. how can effect without adding many of <br> , &nbsp , or adding many of <div style="margin..."> hard code? you can't. same goes heart-shaped, giraffe-shaped, etc. dom elements pretty rectangular. you'l have using javscript. weren't specific on requirements (monospace font, keeping words together, etc.), here 1 example.

java - Maven SLF4J: Class path contains multiple SLF4J bindings -

i getting following exception while compiling java code .please body how can resolve conflict. slf4j: class path contains multiple slf4j bindings. slf4j: found binding in [jar:file:/c:/users/air/desktop/sms/slf4j-1.7.7/slf4j-android-1.7.7.jar!/org/slf4j/impl/staticloggerbinder.class] slf4j: found binding in [jar:file:/c:/users/air/desktop/sms/slf4j-1.7.7/slf4j-jcl-1.7.7.jar!/org/slf4j/impl/staticloggerbinder.class] slf4j: found binding in [jar:file:/c:/users/air/desktop/sms/slf4j-1.7.7/slf4j-jdk14-1.7.7.jar!/org/slf4j/impl/staticloggerbinder.class] slf4j: found binding in [jar:file:/c:/users/air/desktop/sms/slf4j-1.7.7/slf4j-log4j12-1.7.7.jar!/org/slf4j/impl/staticloggerbinder.class] slf4j: found binding in [jar:file:/c:/users/air/desktop/sms/slf4j-1.7.7/slf4j-nop-1.7.7.jar!/org/slf4j/impl/staticloggerbinder.class] slf4j: found binding in [jar:file:/c:/users/air/desktop/sms/slf4j-1.7.7/slf4j-simple-1.7.7.jar!/org/slf4j/impl/staticloggerbinder.class] slf4j: see http://www.slf4

java - Palindrome Program using Recursion -

this have palindrome program computer science class. have pretty working, except whenever word palindrome, infinite loop. know have insert number base case, not how that...i'm having trouble understanding recursion. appreciated. public class palindrometester { public static void main(string[] args) { scanner scan = new scanner (system.in); string str, = "y"; int left, right; while (another.equalsignorecase("y")) { system.out.println("enter potential palindrome:"); str = scan.next(); left = 0; right = str.length() - 1; tester(str, left, right); system.out.println(); system.out.println("test palindrome (y/n)?"); = scan.next(); } } public static void tester (string str, int left, int right) { scanner scan = new scanner (system.in); while (str.charat(lef

c# - Non-English numeric formatting in Visual Studio -

in english-us, decimal separator symbol "." if want write result of 100 + 25/100, 100.25 (obviously). how write in constant in visual studio if i'm french developer living in france? in france use comma (",") decimal seperator. will write const double x = 100.25 or const double x = 100,25 thank you you write programs in c#, not in english. use syntax of c#. const float x = 100.25 when show information non-englsih user can format in appropriate view. for ex.: messagebox.show(x.tostring().replace(".", ",")); // or special format functions

Python Hello World keeps closing itself -

i'm new programming. i''ve wrote everybody's first program , , executes right before closing itself. how can add pause program? modify code this, learn below function enough: print('hello world!') input() now @ end of program won't exit until press return . or better still, run code in shell idle don't have worry that.

ruby - Rails ActiveRecord trigger query for each parameter passed? -

how can trigger different rails activerecord query each time parameter sent controller? if params[:sort].present? sort_input = ['foundation', 'originality', 'dynamics', 'execution', 'battle', 'votes'] @foundation = if sort_input[0].include? #here model.order...activerecord query end @originality = if sort_input[1].include? end @dynamics = if sort_input[2].include? end @execution = if sort_input[3].include? end @battle = if sort_input[4].include? end @votes = if sort_input[5].include? end use case statement case params[:sort] when 'foundation' @foundation = # query goes here when 'originality' @originality = # different query goes here .. else # else case end

javascript - When processing Java mode convert to Java script mode, my 3D object doesn't show -

i have problem when upload sketch website. i write processing program 3d guiding library.this code. //camera variables float x,y,z; float tx,ty,tz; float rotx,roty; float mx, my; float framecounter; float xcomp, zcomp; float angle; //movement variables int movex; int movez; float vy; boolean canjump; boolean moveup,movedown,moveleft,moveright; //check input int m =0; //constants int ground = 0; int totalboxes = 100; int standheight = 100; int dragmotionconstant = 10; int pushmotionconstant = 100; int movementspeed = 50; //bigger number = slower float sensitivity = 15; //bigger number = slower int stillbox = 100; //center of pov, mouse must stillbox away center move float cambuffer = 10; int cameradistance = 1000; //distance camera camera target in lookmode... 8? //options int lookmode = 8; int spotlightmode = 4; int cameramode = 1; int movemode = 2; void setup(){ size

haskell - Fmap and map, I can't see the difference -

i'm trying understand functors are, far can't. what's difference between these 2: prelude> fmap (+1) [1..9] [2,3,4,5,6,7,8,9,10] prelude> map (+1) [1..9] [2,3,4,5,6,7,8,9,10] for lists, there no difference, map fmap specialised lists. fmap has more general type: fmap :: functor f => (a -> b) -> f -> f b this means can used functor e.g. fmap (+ 3) (just 4) -- 7 fmap (+ 4) (+ 3) 1 -- 8. functions functors fmap = (.) fmap read getline :: io int -- io functor while map has type map :: (a -> b) -> [a] -> [b] if @ source , functor instance lists defines fmap map : instance functor [] fmap = map

asp.net - SAAS based mobile application -

we developing saas based mobile application in asp.net. in our business domain have different companies , flows under those. each company has different url, when super admin create company on front end , parse url load each company specific logos , other settings. we confused url management different companies. how should handle different sub domain urls hitting same physical location? , please share other guidelines must follow develop saas based web site. identifying tenants url standard in developing saas applications. it pretty easy , straight forward too. experience, suggest following configure iis site use root level domain (i.e. yourawesomeapp.com). makes subdomain request hit same site. store tenants url tenant1.yourawesomeapp.com, tenant2.yourawesomeapp.com, etc., in tenant table tell tenant use url access application write httpmodule, in postauthenticaterequest event grab current request url , verify tenanturlmapping entries (cache url <-> tenan

c# - Select distinct objects from a List<Object> -

this question has answer here: get distinct values out of list<object> 5 answers i have asked rather similar question here. get distinct values out of list<object> but question not duplicate. similar have stated far duplicate. in other question, getting values using distinct, here getting objects. but i'm having problems right. i have list<beam> defined below: list<beam> beams = new list<beam>; public class { public double elevation; } how can distinct objects list<beam> based on elevation property? you can use groupby here: var distinctbeams = beams .groupby(b => b.elevation) .select(g => g.first()) .tolist();

Laravel, jquery Interdependent select lists Full code -

i have got fine until last line of code cannot load select list of view. can't second select list populated (countries regions cities), knackered because seems clear me , dont understand why can't. in firebug able (at html tab) load select list of regions alright, can't send view. might think matter of sending array view controller, won't work because complain variable undefined @ view. cant have variable there waiting value if pregenerated in ajax fashion, can generate @ controller (or in model too) viewable in firebug. enormously appreciate because have gone limit of ability. had working in codeigniter, cant reproduce in laravel. here stuff: the jquery code <script type="text/javascript"> jquery(document).ready(function(){ //when first select list changes, function activates $('#country').change(cargarprovincias); //load regions when countries change }); function cargarprovincias() { // collects se

linux - How do I record all memory accesses of a process/file? -

for testing cache system, need memory access (read , writes) list particular process. cache code written in verilog. application media processing, i'm open other applications well.. far have been adding address references in c++ code png decoding (available here http://lodev.org/lodepng/ )... this quite tedious process , i'm looking alternatives. i've tried hacking benchmarks simplescalar reading crash dumps, no avail... thanks in advance! it might worth time intel's pin , long you're running on x86. their manual has an example how use pin instrument binary generate memory trace.

javascript - How to react to the fail condition while testing with Selenium WebDriver? -

here test login feature of nodejs application: var webdriver = require('selenium-webdriver'); var driver = new webdriver.builder(). withcapabilities(webdriver.capabilities.chrome()). build(); driver.get('localhost:3012'); var loginform = driver.findelement(webdriver.by.id('login')); loginform.findelement(webdriver.by.name('email')).sendkeys('abcd@abcd.com'); loginform.findelement(webdriver.by.name('password')).sendkeys('1234s'); loginform.submit(); driver.wait(function() { return driver.findelement(webdriver.by.id('welcomemsg')) !== null; }, 1000); driver.quit(); if login successful, alright. but if fails, test never stops. how deal this? (note: there no documentation of api selenium webdriver js find. had ask here.)

java - Overwritten hashCode,equals and get/set- methods necessary in a JPA Entity? -

i have question jpa. absolutly necessary create overwritten hashcode method , overwritten equals method this: @override public int hashcode() { final int prime = 31; int result = 1; result = prime * result + ((id == null) ? 0 : id.hashcode()); return result; } @override public boolean equals(object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getclass() != obj.getclass()) { return false; } usercontent other = (usercontent) obj; if (id == null) { return false; } else if (!id.equals(other.id)) { return false; } return true; } also know, if get- , set methods must implemented. or can leave out , in scenarios can leave out? are method necessary too? @override public boolean isnew() { return this.id == null; } i use eclipselink jpa provider. thanks lot! maik overriding hashcode() , equals() important entities part of collectio

c# - Nokia Imaging SDK 1.2: Applying filter to WriteableBitmap -

i've been trying apply filter nokias imaging sdk writeablebitmap. far, didn't have success. "best" got following, crashes on renderer.renderasync() memorystream stream = new memorystream(app.mainviewmodel.current.album.cover.tobytearray()); streamimagesource streamimage = new streamimagesource(stream); filtereffect filters = new filtereffect(streamimage); writeablebitmaprenderer renderer = new writeablebitmaprenderer(filters); blurfilter blurfilter = new blurfilter(); filters.filters = new[] { blurfilter }; var result = await renderer.renderasync(); the tobytearray() extension method on cover (which writeablebitmap ), provided writeablebitmapex library. has had same problem? you getting exception in renderer.renderasync() because aren't setting writeablebitmap property of writeablebitmaprenderer. the writeablebitmaprenderer can not create writeablebitmap you, needs created on ui thread. must create , pass renderer object (either in construct

ios - SpriteKit Solid Block -

i'm trying make solid platform/block if player lands on it, stands there. have using collisions, seems there easier way. what i'm going effect player can "land" on block, , not go through it. if (firstbody.categorybitmask == playercategory && secondbody.categorybitmask == endplatformcategory) { if (player.position.y > secondbody.node.position.y) { player.physicsbody.velocity = cgvectormake(player.physicsbody.velocity.dx, abs(player.physicsbody.velocity.dy*.5)); } } this code makes fall through after few hits due gravity, however. if understood correctly, try setting player's physicsbody.collisionbitmask interact block. this: self.physicsbody.collisionbitmask = cnphysicscategoryblock; and block's physicsbody.collisionbitmask interact player. self.physicsbody.collisionbitmask = cnphysicscategoryplayer;

java - LibGDX internal button spacing -

Image
i trying create gui in libgdx, having problems buttons. using 9patch image button, looks this: this button scales well, it's when add text button there space between top of button, , top of text. this: the red line marks amount of space between top of button , top of text. space large, , wondering if there way reduce it. the font using not scaled, , normal bitmapfont no filter. regardless of scale, space between text , top edge proportionate, meaning space still looks same size when using small font or large font, relative text size. any suggestions appreciated. to solve problem did following. when adding button table, used following code. table.add(button).height(height).width(width); this did not solve mentioned issue, allowed me explicitly set desired width , height of button, played part in solving actual issue. when creating button, button, being extension of cell, used add() function re-position text. button = new textbutton("button",

php - Displaying Message After Redirecting -

what best way display success message after submitting form , redirecting. i'm developing script smarty template engine , don't want use javascript want easy possible user design or own template , have tried using sessions display message seems unset after redirecting example the form <form action="" id="comment_form" method="post"> <input type="hidden" name="movie_id" id="page_id" value="{$mov.mid}" /> <input type="hidden" name="user_id" id="user_id" value="{$logged_id}" /> <input class="span2" name="comment" type="text" /> <button class="btn" name="add_comment" type="submit">add comment</button> </form> php if (isset($_post['add_comment'])) { if (!empty($_post['comment'])) { $user_id = $logged_id; $post

character encoding - How to convert UTF-8 to GBK string in java -

i retrieved html string objective site , within there section class="f9t" name="Óû§ÃƒÃ»:ôâÈ»12" i know it's in gbk encoding, can see ff browser display. not know how convert name string readable gbk string (such 上海 or 北京). i using string sname = new string(name.getbytes(), "utf-8"); byte[] gbkbytes = sname.getbytes("gb2312"); string gbkstr = new string( gbkbytes ); system.out.println(gbkstr); but it's not printed right in gbk text ???¡Ã¬??:????12 i have no clue how proceed. assuming name.getbytes() returns gbk encoded string it's enough create string specifying encoding of array of bytes: new string(gbkstring.getbytes(), "gbk"); regarding documentation name of encryption should gbk . sample code: string gbkstring = "Óû§ÃƒÃ»:ôâÈ»12"; string utfstring = new string(gbkstring.getbytes(), "gbk"); system.out.println(utfstring); result (not 100% sure it's correct :) ): è„«è„™

php - How to preg match to parse the value addr: in this string -

i got string of blockchain of below {"double_spend":false,"block_height":294529,"time":1396809215,"inputs":[{"prev_out":{"n":1,"value":68000,"addr":"1zzzzhhdll5zked9gbakpt4j3vzgumvhg","tx_index":53988341,"type":0,"script":"76a91406287de03de2b4cdd4095ce75c4101004677876b88ac"},"script":"76a91406287de03de2b4cdd4095ce75c4101004677876b88ac"}],"vout_sz":2,"relayed_by":"107.170.67.24","hash":"5f63a2dcbef2e534934b1919430d2ccafa030ec1f8011581a58b43b1d529db5e","vin_sz":1,"tx_index":54014213,"ver":1,"out":[{"n":0,"value":10000,"addr":"1l3zer3u5qg8zz59c3td9ecuwekeszcvnf","tx_index":54014213,"spent":true,"type":0,"script":"76a914d0e6208c2d26e09ff8b51c1b5ba12b4dcf66b71f88ac&

c++ - Tbb concurrent hash map iterator -

i'm traversing entire tbb concurrent hash map using iterator , inspecting each (key,value) pair. for (map::pair = myhashtable.begin(); myhashtable.end(); pair++) how can parallelize iterator? use range() method described in reference manual : hashtable_t myhashtable; // assuming hashtable_t concurrent_hash_map specialization tbb::parallel_for( myhashtable.range(), [](const hashtable_t::range_type &r) { for( hashtable_t::iterator = r.begin(); != r.end(); i++); } ); (i use c++11 concision show types explicitly sake of c++03 ) and please pay attention caution note there: do not call concurrent operations, including count , find while iterating table. use concurrent_unordered_map if concurrent traversal , insertion required.

php - How to remove duplicate values compare two array -

i have 2 array. one array ( [0] => array ( [driverid] => 3 [latitude] => 23.752182 [longitude] => 90.377730 [distance] => 0 [esttime] => 0 ) [1] => array ( [driverid] => 6 [latitude] => 23.752782 [longitude] => 90.375730 [distance] => 0.2341134331552646 [esttime] => 133 ) ) two array ( [0] => array ( [driverid] => 3 ) [1] => array ( [driverid] => 61 ) ) first array store in $info , second array store in $infor here first array item driverid 3 , second array item driverid 3. so in output want skip first array first item. when looping through each array store driverid in array , check current driverid not in array, if can skip it. example: $ids = array(); foreach($infor $arr2)

php - How to troubleshoot Magento when Developer mode errors out. -

i'm attempting troubleshoot custom module i'm working on. website seems work fine no noticeable or logged errors. when enable magento developer mode white screen. points towards php errors. when check server error logs i'm getting following error: php fatal error: class 'mage' not found in /var/www/index.php on line 41 i'm not sure do? googling hasn't seemed much. i'm getting error in developer mode. what version of magento using? seems index.php has been changed. the best way debug this, can: compare files freshly downloaded magento code. check index.php on line 41, if there's code calling 'mage' class just fyi, if code exists , need it. can move code after code (line 68 on community 1.8.1) require_once $magefilename; hope help.

WPF - wrapping stackpanel -

i have panel width = 1400 , contains smaller panels width = 700. if screen @ full width smaller panels should displayed in 2's per row otherwise should wrap , vertical scrollbar should appear. with below code contents wrapped no scrollbar: <stackpanel grid.column="1" grid.row="1" width="1400"> <scrollviewer x:name="body" horizontalscrollbarvisibility="disabled" verticalscrollbarvisibility="auto"> <wrappanel orientation="horizontal" maxheight="700" width="{binding elementname=body, path=viewportwidth}"> <border borderbrush="black" borderthickness="1" width="700" height="400"> </border> <border borderbrush="black" borderthickness="1" width="700" height="400"> </border> <border borderbrush=&

Gauss-Seidel Solver for Python 2.7 -

is there python 2.7 package contains gauss-siedel solver systems more 3 linear algebraic equations containing more 3 unknowns? simple example of sort of problem solve given below. if there no templates or packages available, possible solve in python? if please advise on best way of going it. thanks. an example of 3 linear algebraic equations 3 unknowns (x,y,z): x - 3y + z = 10 2x + 5y + z = 4 -x + y - 2z = -13 after bit of searching around found solution use numpy.linalg.solve command. command uses lapack gesv routine solve problem; not sure iterative technique uses. here code solve problem if interested: a = np.array([[1,-3,1],[2,5,1],[-1,1,-2]]) b = np.array([10,4,-13]) x = np.linalg.solve(a, b) print x print np.allclose(np.dot(a, x), b) # check solution found

c# - MVC.NET the ViewModel from Create POST is always null -

in mvc.net project used scaffolding templates. ther binded 1 dto model. decided wanted link viewmodel, because have 2 multiselects need use pass values. how viewmodel looks: public class createquestionmodel { public question question { get; set; } public list<int> politicianids { get; set; } public list<int> topicids { get; set; } } my create post method getting viewmodel view: [httppost] [validateantiforgerytoken] [authorize(roles = "regular")] public actionresult create(createquestionmodel question) { if (modelstate.isvalid) { int id = websecurity.currentuserid; manager.createquestion(question.question, id, question.politicianids, question.topicids); return redirecttoaction("index"); } return view(question); } and create.cshtml looks this: @model politicionline.models.createquestionmodel @{ viewbag.title = "stel een vraag!"; } <head> <link rel="stylesheet" href="~/content/que

Releasing Android App with the debug key -

i realized released android app google play debug key , somehow developer console couldn't detect debug key. can't change key can update app old key. keytool says key expires in 2040 read debug keys have 1 year of expiry. should worried won't able update app anymore in future?

php - MySQL Select from 3 tables and get attendance In and Out Time for all Members in specific date -

i have 3 table this: members_tbl id | fullname | email | mobileno attendance_in_tbl id | member_id | datetimein attendance_out_tbl id | member_id | datetime_out i want select members date: 2014-03-10 query: select attendance_in.edatetime, members_info.mfullname, attendance_out.odatetime attendance_in left join members_info on members_info.id = attendance_in.memid left join attendance_out on attendance_out.memid = attendance_in.memid date(attendance_in.edatetime) or date(attendance_out.odatetime) = "2014-03-10" but give me different results in attendace_out results you have mistake in query. you wrote: date(attendance_in.edatetime) /* wrong! */ or date(attendance_out.odatetime) = "2014-03-10" this wrong, first expression date(attendance_in.edatetime) evaluates true . you may want where date(attendance_in.edatetime) = "2014-03-10" or date(attendance_out.odatetime) = "2014-03-10" but, guaranteed perform

npm install access denied error on ssh git repo - windows7 -

i trying developer run npm install on windows machine getting access denied error 1 of private project dependencies in package.json . project cloned 1 coming on same domain , in same project in stash. 1222 silly lockfile 836362be-che-generator-cuff-0-0-1-package tar://c:\users\knzn\appdata\roaming\npm-cache\generator-cuff\0.0.1\package 1223 silly lockfile 836362be-che-generator-cuff-0-0-1-package tar://c:\users\knzn\appdata\roaming\npm-cache\generator-cuff\0.0.1\package 1224 silly lockfile 47037b47-generator-cuff-0-0-1-package-tgz tar://c:\users\knzn\appdata\roaming\npm-cache\generator-cuff\0.0.1\package.tgz 1225 silly lockfile 47037b47-generator-cuff-0-0-1-package-tgz tar://c:\users\knzn\appdata\roaming\npm-cache\generator-cuff\0.0.1\package.tgz 1226 verbose chmod c:\users\knzn\appdata\roaming\npm-cache\generator-cuff\0.0.1\package.tgz 644 1227 silly chown skipping windows c:\users\knzn\appdata\roaming\npm-cache\generator-cuff\0.0.1\package.tgz 1228 silly lockfile 9e23d6fc-net