Posts

Showing posts from March, 2012

android - Getting Following error when uploading app to google play -

i'm receiving following error while uploading app google play. unable figure out reason. this configuration cannot published following reason(s): device api levels in range 8+ eligible receive version 2, optimized higher api levels, receives version 3 because has higher version code. occur when screen layouts containing of [small, normal, large, xlarge] , features containing of [android.hardware.location, android.hardware.location.gps, android.hardware.location.network, android.hardware.touchscreen]. device upgrading api levels = 7 api levels in range 8+ become eligible receive version 2, optimized higher api levels, receive version 3 because has higher version code. occur when screen layouts containing of [small, normal, large, xlarge] , features containing of [android.hardware.location, android.hardware.location.gps, android.hardware.location.network, android.hardware.touchscreen] you have version codes messed up. check in manifest, , make neccessary changes. ...

javascript - Get Division in the html tag with value of the elementa -

hi need image tag should generated in division number of times receives object. doesn't work. can please me same. appreciated. <div id="validation" class="subcontent" > <script type="text/javascript"> parse.initialize("@@@@", "@@@@"); //var description1 = document.getelementbyid("news").value; var uid1 = document.getelementbyid("uid").value; var interior= parse.object.extend("interior"); var query = new parse.query(interior); query.equalto("user_id", uid1); query.find({ success: function(results) { alert("successfully retrieved " + results.length + " scores."); (var = 0; < results.length; i++) { // not require network access. var imageurl = results[i].get("image_url"); var imageur2 = results[i].get("image_title"); var elemen = imageurl; var elemen1 = imageur2; var content = "<...

c++ - Undefined reference to `typeinfo for class' and undefined reference to `vtable for class' -

this question has answer here: undefined symbols “vtable …” , “typeinfo for…”? 4 answers i'm dealing inheritance in c++. wanted write program addition , subtraction of 2 arrays. heres code: #include <iostream> #include <cmath> #include <sstream> using namespace std; class root { protected : int size; double *array; public : virtual ~root() {} virtual root* add(const root&) = 0; virtual root* sub(const root&) = 0; virtual istream& in(istream&, root&) = 0; virtual int getsize() const = 0; virtual void setsize(int); virtual int getat(int) const = 0; }; class aa: public root { public : aa(); aa(int); aa(const aa&); root* add(const root& a); root* sub...

android - Dynamically created button not fill the parent -

i creating table row dynamically in android , creating button in row. rendering fine created button fills parent, i.e. occupies full width of parent row. want fixed width array i.e. 150px. my code tablerow rows = new tablerow(this); tablelayout.layoutparams tablerowparamss= new tablelayout.layoutparams (tablelayout.layoutparams.fill_parent,tablelayout.layoutparams.wrap_content); rows.setbackgroundcolor(color.parsecolor("#62b0ff")); tablerowparamss.setmargins(0, 0, 0, 40); rows.setlayoutparams(tablerowparamss); button ib = new button(this); //ib.setbackgroundresource(r.drawable.accept); final float scale = getresources().getdisplaymetrics().density; int heightdp = (int) (33 * scale + 0.5f); int widthdp = (int) (60 * scale + 0.5f); viewgroup.layoutparams blp = new viewgroup.layoutparams(widthdp,heightdp); rows.addview(ib); table.addview(rows); how can make button width fixed 150px , align right side...

python - Matplotlib plots (pcolormesh and colorbar) shift with respect to their axes when using rasterized=True -

Image
i use matplotlib pcolormesh plots colorbars, apply rasterization plots , colorbars in order reduce file size , save figure pdf file. thereby noticed, after rasterization color-area shifts bit respect axes towards , left, white stripe @ lower , right edge of plot appears. same happens colorbar, found worse: thin colorbars, white stripe obvious , disturbing. there way avoid behaviour of rasterized plots , keep rasterized area @ same place before rasterization? i tried play around rasterization_zorder , zorder settings . helped bit pcolormesh plots (the lower white stripe disappeared), found no way apply colorbar . down there simple example 4 plots demonstrating problem. please zoom in pdf file @ lower right edges of plots see mean. import numpy np import matplotlib.pyplot plt d = np.arange(100).reshape(10, 10) myfig = plt.figure(figsize=(5, 5)) '''plot 1, no rasterization''' ax1 = plt.subplot(221) plot1 = ax1.pcolormesh...

javascript - PHP View-Controller-Class Model -

Image
i have open ended question php view-controller-class model. say, have perform logic loop in controller use method in class retrieve data row database. however, @ time, can set 1 php variable in view display content. need understand how display data in nicely tabulated html format controller. i know 1 way use javascript $(#div_id).html(variable_embedded_html_coding); all advise appreciated. to have nicely looked table can use phpgrid.com to send message php js having more 1 variable. can use example json or xml . encode array in php json format use json_encode(); in ajax should change datatype json . so js side should this var request = $.ajax({ url: "script.php", type: "post", data: {id : menuid}, //it'll in $_post['id'] datatype: "json" }).done(function(msg){ $("#your_div").html(msg.html); //msg.othervariable possible here }); from php(script.php) $arr = array('html'=> "...

alarmmanager - How to ignore delayed Android Alarms? -

i have multiple repeating alarms. for example, if repeat every hour: i don't want take action alarm should have been triggered @ 08:00 couldn't because phone off 06:45 08:45. when phone turns on, want take action alarm takes place on 09:00am not 08:00 or 07:00 am.

c - What is the correct return of PyObject_CallObject in the presence of a Python exception? -

all examples can find check return value against null pointer, , yet in our code receiving valid pointer. know exception has occurred because have written log file before , after failing line. when @ return value says "nonetype": returnvalue->ob_type->tp_name . the call returned none object in case, , not null, indicating there no exception far call concerned. if whatever called used try: / except handler, exception has been caught , cleared; purpose of such handler. if need exception propagate further stack, re-raise it: try: # ... except someexception e: # log information `e` raise

java - moving from single webapp to multiple webapps connecting to same database -

i have java webapp using db connection pooling tomcat+mysql config. i have java webapp want deploy in same tomcat , connect same mysql database (even access data same tables). i havent figured out way how achieve same. should have connection pooling context.xml each of webapps? or should have global configuration. in first case , assume there nothing different need do. deploy webapp has own context.xml.. please correct me if i'm wrong. if having global config better solution, how achieve that. haven't found tutorials it. changes in each of webapps need made , knows needs read global config. there's nothing wrong having separate context each webapp unless want centrally manage changes database (i.e. migrate different db, change connection parameters). if think connection properties change or want flexibility can use jndi datasource in tomcat , manage there (google friend that).

android - Set Lists elements in proper / effective way in Java -

i programming in java android project. want set 0 elements list int j = 0; for(@suppresswarnings("unused") integer integ : listitemsnum) { listitemsnum.set(j, 0); j++; } how make more effective? you can use collections.fill(list<? super t> list, t object) method. more on this: http://developer.android.com/reference/java/util/collections.html sample: collections.fill(yourlist, integer.valueof(0))

php - Getting full join by cdbcriteria yii, mysql db? -

using cdbcriteria class of yii how can full join(db mysql)? know can achieved through union of left join , right join.....but syntex not getting $criteria = new cdbcriteria; $criteria->with = array( 'posts' => array( 'jointype' => 'inner join', 'together' => true, ), ); $models = user::model()->findall($criteria); foreach($models $model) { echo $model->username;// gives username foreach($model->posts $post) { echo $post->title; // gives post title } } // if it's 1 user: $criteria = new cdbcriteria; $criteria->addcondition('user_id', (int)$user_id); $criteria->with = array( 'posts' => array('together' => true, 'jointype' => 'inner join'), ); $model = user::model()->find($crieteria); echo $model->username; foreach ($model->posts $post) { echo $post->title; } // can: $model = user::model()->with('p...

ruby on rails - How do I refactor this object to lessen dependency on callbacks? -

i have order object belongs_to billingaddress , shippingaddress . want present user shippingaddress fields , checked checkbox indicating billing address matches shipping address. if user unchecks box, billingaddress fields appear. my implementation feels clunky , order object has lot of callbacks. class order < activerecord::base attr_accessor :bill_to_shipping_address belongs_to :billing_address, class_name: 'address' belongs_to :shipping_address, class_name: 'address' accepts_nested_attributes_for :billing_address, :shipping_address after_initialize :set_billing_to_shipping_address before_validation :set_billing_address after_validation :clear_billing_address_errors # init object option checked def set_billing_to_shipping_address self.bill_to_shipping_address ||= '1' end # copy shipping address attrs billing address def set_billing_address self.billing_address = self.shipping_address if bill_to_shipping_addr...

api key - How to get google map apikey in android -

Image
hi @ time working on google map. want display map in activity. display map view. cant show map think have wrong api key how can api key of google map. create keystore , procedure didn't have idea how api key keystore. i give permission in manifest file , add google map library cant show map.in activity extends mapactivity , write code fro map in xml. if knows please tell me. if have key got link below , add fingerprint along android project package name you need login google account https://code.google.com/apis/console click on create new key. add fingerprint along android project package name. you can see api key above enable google map api v2 services tab. then in manifest file under application tag <meta-data android:name="com.google.android.maps.v2.api_key" android:value="my key"/>

c# - Thread safety multiple process -

i need run process multiple times. each time call static method implement objects process , processstartinfo . processstartinfo properties has modified return errors or outputs. possible call static method inside parallel.for loop? couldn't find document thread safety related this. public static void run(string item1, string item2, string item3, string item4) { var procinfo = new processstartinfo(program.exe,(item1+item2+item3+item4)); procinfo.createnowindow = true; procinfo.useshellexecute = false; procinfo.workingdirectory = environment.currentdirectory; procinfo.redirectstandarderror = true; var process = process.start(procinfo); process.waitforexit(); string error = process.standarderror.readtoend(); int exitcode = process.exitcode; console.writeline("error>>" + (string.isnullorempty(error) ? "(none)" : error)); console.writeline("exitcode...

asp.net mvc - Excluding specific records using LINQ query -

studentid session semester subject 1 2012 1 1 1 2012 1 2 1 2012 1 3 1 2012 1 4 1 2012 1 5 1 2012 2 6 1 2012 2 7 1 2012 2 8 1 2012 2 9 1 2012 2 10 1 2013 2 1 1 2013 2 13 1 2013 2 14 1 2013 2 15 1 2013 2 16 1 2013 3 17 1 2013 3 18 1 2013 3 19 1 2013 3 20 1 2013 3 21 i don't know can name query want generate. searched lot couldn't find result. want write query me select records of semester 1,2 , 3 want exclude records same semester of different session. (i want retrieve semester 1 of 2012 , 2 ,...

java - weblogic & websphere DataSource configuration -

my application has deploy , run on weblogic , websphere. in cdi bean use @resource annotation inject datasource. @resource(name = "datasources/example", mappedname = "datasources/example") datasource datasource; on weblogic works properly, on websphere doesn't. resourceinjec e cwowb0102e: jcdi error has occurred: unable obtain instance datasources/example: javax.naming.namenotfoundexception: name comp/env/datasources not found in context "java:". is there easy configuration possibility works in 2 cases? thanks

c# - How to Store file path in asp.net MVC4 -

this question has answer here: unrecognized escape sequence path string containing backslashes 5 answers hi need store file path of folder on string variable in asp.net mvc 4 when i'm using following method shows error unrecognized escape sequence static string path="c:\path"; what reason of error , how can solve this???? you need escape '\' '\', so: static string path="c:\\path"; or put '@' in front of so: static string path = @"c:\path"; duplicate: unrecognized escape sequence path string containing backslashes related reading: 2.4.4.5 string literals

ruby on rails 3 - How to use a local gem in console with bundled environment -

i want customize development environment few gems. using bundler rails 3.0.x. have gems in local system , dont want add them gemfile. how can pass bundler , require these gems in console opened using bundle exec ? i found 1 way it, though it's little hacky. $ gem install gem_name $ gem gem_name # outputs <full path gem>/lib/gem_name.rb $ rails console > $load_path << "<full path gem>/lib" > require 'gem_name' i'm doing play around different ruby performance gems, although might easier add gemfile, bundle, , revert before push changes.

joomla2.5 - Joomla show contacts of subcategories -

joomla 2.5 i created following structure of contact categories : category 1 (does not contain contact) subcategory 11 (contains contacts, parent = category 1) subcategory 12 (contains contacts, parent = category 1) coming menu type "list contacts in category" want show contact page : subcategory 11 : contact a contact b subcategory 12 : contact c contact d i copied category tmpl files in html folder of template , page shows : subcategory 11 subcategory 12 now need modify script show each subcategory can't see how can access contact items could me ? gustav

Retrieving precise drop position of Android View -

the target application allows user drag/drop views move them in framelayout or store them in linearlayout. the overall mechanism works can't precision need on position when view dropped, "jumps" little further. how retrieve position of drag shadow put dropped view shadow was, in order avoid "jump" artefact? for sake of example, layout pretty simple, here's overview 2 textview objects can moved around (i removed details): <linearlayout xmlns:android="http://schemas.android.com/apk/res/android"> <linearlayout android:id="@+id/repository"/> <framelayout android:id="@+id/frame"> <textview android:id="@+id/view1"/> <textview android:id="@+id/view2"/> </framelayout> </linearlayout> first, improve start position of drag shadow itself, i'm overriding onprovideshadowmetrics . that, view doesn't jump when user starts dragging it: ...

c++ - resurrecting a project written in Visual studio 6 -

i've been given source code image classification application written in visual studio 6. i've tried see if of projects can compiled. there project file .dsp extension. i'm using visual c++ express 2010. when try load dsp file says needs conversion. reply yes. no avail: conversion process seems fail quietly because don't see source file icons appearing in tree view of project after this. i've been wondering whether it's worth trying recompile old code @ all. after it's written old framework , latest wpf considered more elegant. , there's qt quite conversant in alternative. now possibly try hold of old visual studio 6 c++ compiler, think wasting time? need ideas make informed decision on this. if program uses mfc library can not ported "express" version of visual c++. express versions not support mfc. higher versions (the ones have pay for) can support older mfc program, typically bit of editing.

java - Multiple Instances Of JavaApplication -

is possible run more 1 instance of javaapplication developed in netbeans? project uses sockets , need multiple instances of application test it. before netbeans used eclipse allows me run more instances clicking 2 or 3 times on "run"-button. you can build project , run jar multiple times : java -jar ../dist/project.jar to answer question : yes can , hit f6 multiple times (number hits = number instances)

sqlite - Complex SQL Query - nested query -

here job_form table... job_num | name | address | ---------+------+---------+ 1 | tom | smith | 2 | john | doe | 3 | max | smith | here individual_job table... job_num | date | description | ---------+------+---------------------+ 1 | 23-01-2012 | eat food | 1 | 24-01-2012 | dishes | 1 | 25-01-2012 | sweep floor | ... | ... | ... | 2 | 19-05-2013 | play games | 2 | 23-05-2013 | code | 2 | 27-05-2013 | sleep | ... | ... | ... | 3 | 23-05-2013 | eat food | 3 | 24-05-2013 | dishes | 3 | 25-05-2013 | sweep floor | ... | ... | ... | i create query pulls out single row each job_form includes date of first job completed, date of last job completed total number of jobs listed on form. query needs display job forms have jobs need completed in future. example is: job_num | ...

debugging - mysql: ERROR: Option 'debug=d:t:o,/var/log/list.log' used, but is disabled -

in app mysql: error: option 'debug=d:t:o,/var/log/list.log' used, disabled how can enable --debug in mysql? if possible without changing my.conf. i found following solution instead of mysql --debug ....... i mysql ............... <<eof 2>>/var/log/list.log its saving errors , warnings file

php - Google Search Engine Effect and auto complete -

i working in company website has front o index page google search form. create same effect google, once start looking product, switch having search form in center of page having in top of page, plus having auto complete search field. i using php , mysql website. i appreciate feedback since got deadline set boss. thank in advance help. cheers. easiest way of changing page using jquery's .change() function it: http://api.jquery.com/change/ but work acquire effect. for auto completion can use jqueryui's autocomplete: http://jqueryui.com/autocomplete hope helps , luck deadline ;)

Python class variable not updating -

i have class taking in id , trying update variable current_account when print out details of current_account hasn't updated. anyone got ideas this? new python might doing stupid can't see. class userdata: def __init__(self, db_conn=none): if none == db_conn: raise exception("db connection required.") self.db = db_conn self.set_my_account() self.set_accounts() self.set_current_account() def set_current_account(self, account_id=none): print account_id if none == account_id: self.current_account = self.my_account else: if len(self.accounts) > 0: account in self.accounts: if account['_id'] == account_id: self.current_account = account print self.current_account['_id'] else: raise exception("no accounts available.") ...

C / C++ - How to manage the cycles in a video game? -

i have made video games in c (small personal project). , problem encountered every time same, how manage cycles in game. for example, coded snake in sfml. handled cycles frame rates: 5 frame rates while normal, , power up, changed 10. works. it's hideous. , won't work correctly bad computer. in same idea, made game decided cycle equal turn of loop (with infinite loop). same problem, high performance computer go faster low one. so, can advice me on how manage correctly , cycles in video game. thanks in advance ! in broad terms, need model game state such can "advance" given increment of time, , then, during each cycle of main loop, determine how time has elapsed (typically small fraction of second) , advance game state much. how games appear work smoothly regardless of frame rate. the interval becomes scaling factor on movement. example, if snake moving forward @ 5 units of distance per second, , during main loop find 0.01 seconds have elapsed sinc...

javascript - User Input in Google Spreadsheet Script -

i have script creates big matrix based on kinds of variables. a few variables change periodically , values hard-coded need update script often. how can prompt dialog , ask user info , use said info few of variables? want dialog couple text boxes user input , ok button continue script. found it. create variable this: var buildversion = browser.inputbox("build version"); this create popup dialog asks user input "build version"

java - Package that calls different classes when given input to? -

i have taken of classes intro java college in highschool class, , put them package called gamechoices . made class call these classes when user asks them, called whichgame . i've imported classes want called using import gamechoices ."whatever game is";. how call these classes in whichgame ? have them public static main(string [] args) , ones shouldn't have that(i think it's whichgame should..)? , put instead? helping newbie out :) the simplest way set big if/then statement. if(input.equals("t")) thisone.start(); else if(input.equals("a")) anotherone.start(); else if(input.equals("y")) yetanotherone.start(); and on. might pain if have lot of classes, or if start same letter.

javascript - IE8 Object doesn't support property or method 'on' - object.listenTo - (Backbone.js) -

having issues ie8 compatibility javascript code cannot seem run down. code works fine in ie9+, chrome , ff. have backbone.js collection listening series of other backbone collections changes in models. ie 8 giving error when applying event listeners. code is; for(var k in this.referencetables){ this.listento(this.referencetables[k], 'change', this.fetch); } and ie8 (note: ie10 in ie8 browser mode, document mode ie8 standards) returning in console error object doesn't support property or method 'on' @ line 2 of above code. the above code block in initialize function of backbone collection.extend. this.referencetables assigned in initialize function this.referencetables = options.referencetables // options.referencetables array of backbone collections i bit stumped ideas appreciated! for...in iterating on enumerable properties of object , if want iterate on values in array, referencetables is, should use normal for loop. for(var k ...

javascript - Kendo grid read action trigering? -

i using kendo grid , creating grid in document.ready function.initially while creating grid not have read.but after selecting value have populate grid certian values database.so want trigger read of kendo grid after selecting value.so @ time want give path read action.is possible?? for exampe in document.ready creating datasource grid this datasource = new kendo.data.datasource({ serverpaging : true, serversorting : true, serverfiltering : true, servergrouping : true, serveraggregates: true, transport: { read: { }, update: { } } }); and when user selects value field have set url fro read name field user selects value so $("#name").change(function(){ //set read action here , read data grid }); var _theurl; datasource = new kendo.data.datasource({ serverpaging: true, serversorting: true, serverfiltering: true, servergrouping: true, serveraggregates: true, ...

html - IE indents table within a table properly but Firefox doesn't -

i thought problem might &nbsp playing around while didn't fix it. assume ie either ignoring incorrect code , why looks correct on ie <table class=ctable border=1 cellpadding=4 cellspacing=0 width=50%> <tr> <th class=th1 colspan=3>hours summary 04/17/2011 - 04/30/2011 </th> <th class=th1> </tr> <tr> <th> cost center </th> <th> cost center name<br> <font size = '1'>cost center owner</font> </th> <th> completion<br>status </th> <th> approval<br>status </th> </tr> <tr class='ctablealttd' > <td align='center'><a href='javascript:toggledisplay("tr427200");'>427200</a> </td> <td align='center'>medctr-non med center approvers<br>harrison,rod...

c# - Memory confusion -

i have app in i'm trying create large "cube" of bytes. 3 dimensional array (~1000x1000x500) saves of values i'm interested in - i'm getting out of memory problems. while expected, behavior of various oom messages i'm getting has been quite confusing. first: foo[,,] foo1 = new foo[1000, 1000, 500]; fails oom error, not: foo[,,] foo1 = new foo[250, 1000, 500]; foo[,,] foo2 = new foo[250, 1000, 500]; foo[,,] foo3 = new foo[250, 1000, 500]; foo[,,] foo4 = new foo[250, 1000, 500]; shouldn't these 2 sets of code consume same amount of memory? also, getting error message when ~1.5gb had been consumed, assumed switching 64bit application let me use more memory before failing. am running stack space limitations? , if so, how can instantiate structure entirely on heap without ever having exist (as single entity) on stack? thanks in advance - forward light can shead on behavior. edit i musing on more featured implementation of answ...

grep - How do I mimic `ls foo*bar` in R? -

completely stumped, though seems simple question voted down shortly duplicate, couldn't find right "pattern" search answer. i looking files in folder match dual pattern , want open them in r. so, assume list.files produces following: lf <- c("foo_23_bar.txt", "goo_42_mar.txt", "boo_42_bar.txt") in command line, use ls foo*bar find first file, in r, like, grep(paste("foo","bar",sep="|"),lf) returns both files 1 , 3. not sure how use perl=true option. great. thanks! i use system function. check out here. http://stat.ethz.ch/r-manual/r-patched/library/base/html/system.html

imap - php imap_fetchbody strange encoding -

i have little problem imap_fetchbody. accessed script below: $string= "{imap.gmail.com:993/imap/ssl/novalidate-cert}"; $mbox = imap_open($string.$_get['f'], "mail@gmail.com", "password"); $message = imap_fetchbody($mbox,$_get['email'],'1.2'); then printed $message content, , got this: attenzione il presente messaggio ed suoi = allegati devono intendersi ad uso esclusivo dei suoi destinatari e sono = confidenziali. se ricevete questo messaggio per errore, vi preghiamo = di cancellarlo, di distruggerne ogni copia e di informarci = immediatamente. internet non garantisce l'integrit=e0 dei messaggi. = la scrivente declina pertanto ogni responsabilit=e0 in caso di = intercettazione o modifiche del presente = messaggio. i know e0 equivalent tot à, , replace in case, have random = signs, , can't remove them. i'm trying resolve problem. looked @ html, , have this: <p =="" class="3dms...

Insert Image as a shape in Visio - VBA -

i want able import image shape in visio using vba. i've tried insert image using following, doesn't work... myshape.import(imagepath) however, mypage.import(imagepath) works fine , places image in center of page, have no way of manipulating shape. i've tried searching web, can't seem find way using vba. just expanding on @tim , @mike comments here's quick snippet wraps import part function sub tryaddimage() dim vpag visio.page set vpag = activepage dim shpimg visio.shape set shpimg = addimageshape(vpag, "c:\myimage.jpg") if not shpimg nothing 'do new shape shpimg.cellsu("width").formulau = "=height*0.5" end if end sub private function addimageshape(byref vpag visio.page, filename string) visio.shape dim shpnew visio.shape if not vpag nothing dim undoscopeid1 long undoscopeid1 = application.beginundoscope("insert image shape") on error resume next: set shpnew = vpag.import(file...

jquery - Find element where child items h2 text has a specific value -

i think simple can't seem find right selector syntax. have html this: <div class="parent"> <h2>summary</h2> <p>... bunch of content ...</p> </div> <div class="parent"> <h2>statistics</h2> <p>... bunch of content ...</p> </div> <div class="parent"> <h2>outcome</h2> <p>... bunch of content ...</p> </div> i want find div h2 child contains text 'statistics'. i tried various combinations of: $(".parent").find("h2[text='statistics'").parent() which doesn't work find returns empty set. if this: $(".parent").find("h2").text("statistics").parent() i 3 elements- of appear div containing statistics. add first() that, seems kind of gross. right syntax find 1 item? use: $(".parent").find("h2:contains('statistics...

Node.js - Query within a query, then render results using Express -

i'm new node lands of c#, php , python. i've been working days in many variations of same problem - how can retrieve set of data, based on data, retrieve set, render results out. i've tried method below, event based (client.on("row")) , async module , can't produce right results. in end, i'd pass projects object tasks added express render. could me out of hole? exports.index = function(req, res){ req.session.user_id = 1; if (req.session == undefined || req.session.user_id == null || req.session.user_id < 0) { res.redirect('/login'); } else { var pg = require('pg'); var constring = "postgres://jason@localhost:5432/simpleproject"; var client = new pg.client(constring); client.connect(function(err) { client.query("select * project", function(err, projects) { (var i=0; i<projects.rowcount; i++) { var project = projects.rows[i]; cli...

php - CakePHP SoapClient drops fields? -

my app uses cakephp (2.2.5) data soap server. put logging soapsource.php connector see xml returned , display array returned: $result = $this->client->__soapcall($method, array('parameters' => $tparams)); logger::write('soap last response', $this->client->__getlastresponse(), 3, 'transaction'); logger::write('soap last response object', print_r($result, true), 3, 'transaction'); but i'm seeing in log 2 (recently-added) fields present in xml missing array, specifically, last 2 before rplist (formatted here otherwise verbatim): <transactionresult> <id>test</id> <resultcode>0</resultcode> <readscheduledrecordingsrsp> <recordingdefinitionlist> <recordingdefinition> <rdid>d8c16d8f-67c6-469a-83c3-d51d8f8859a9</rdid> <title>the young , restless</title> <seriesid>4422</seriesid> <keepuntil...

windows phone 8 - Determine if user opened an application by tapping currently playing song in system menu -

Image
in windows phone 8 it's possible enter applications use backgroundaudio service tapping name of playing audio in systemwide accessible menu. can somehow detect specific entrance point inside application? pic related :)

Removing CheckBoxList crashes page (ASP.NET) -

i working form built. i'm trying remove checkboxlist there. don't need on form. <asp:checkboxlist tabindex="6" id="ddlschool" runat="server" repeatdirection="vertical" repeatlayout="table"> <asp:listitem value="item">item</asp:listitem> <asp:listitem value="item">item</asp:listitem> <asp:listitem value="item">item</asp:listitem> <asp:listitem value="item">item</asp:listitem> <asp:listitem value="item">item</asp:listitem> <asp:listitem value="item">item</asp:listitem> <asp:listitem value="item">item</asp:listitem> <asp:listitem value="item">item</asp:listitem> <asp:listitem value="item">item</asp:listitem> </asp:checkboxlist></div> ...

php - PDO getting only one value -

i querying database latest row entered , id column only, sure 1 value. however, unable print variable unless in foreach loop, not accessing 0th element giving me output. i use line of code querying latest row's id added: $id = $db->query("select max(id) fm;"); when use foreach loop, following output: loop: foreach ($id $i) print_r($i); output: array ( [max(id)] => 20 [0] => 20 ) however, when use print $id[0]; or print $id["max(id)"]; http error 500. how can single value id , put in variable, id is? thanks instead of selecting max(id) have use lastinsertid() method $id = $db->lastinsertid(); right after calling insert query

How to implement a solve predicate for this "moving blocks" Prolog exercise? -

Image
i studying prolog using ivan bratko book: programming artificial intelligence , finding difficulties implement final part of exercise proposed the exercise program use graphs decide how move blocks , arrange them in order. this image related program have do: as can see in previous immage blocks a,b,c can moved using number of admissible moves are: a block can moved if @ top of stack a block can moved on ground (on void stack) a block can moved on block (at top of stack contains others blocks) so these admissible moves induce graph of possible transitions between 1 state , state in graph, this: so, can se in previous graph can rappresent situation using list of 3 sublist. each sublist rappresent stack can put blocks according previous constraints so example situation of central node of previous graph can represented by: [[a], [b], [c]] because each stack contains single block. the situation represented node @ top left stacked 1 below other blocks c,a,b ...

inheritance - C++ initialization list in second derrived class -

i'm trying write relatively deep class heirarchy , compiler keeps throwing "no matching function call [default constructor bass class]". here's scenario: class { a(int);//note, no default constructor } class b : public { b(int i, int j) : a(i), somemembervariable(j) {} int somemembervariable; } class c : public b { c(int k, int l) : b(k, l) {} } and compiler throws error on line constructor of class c saying "no matching function call a::a()" , tells me use a::a(int). i understand don't have default constructor class a, , compiler getting confused when try subclass subclass. however, don't understand why. have used initialization list avoid that. if use classes 2-levels deep works fine, third class gives me error. doing wrong here? as people commented needed make constructors public , code had formatting issues: class { public: a(int a) : blah(a) {}; //note, no default constructor int blah; }; c...

php - Regex matching a date and time -

i'm trying match specific datetime format in php's regex: dd-mm-yyyy hh:ii:ss it should in format. meaning example when first day of month there must leading zero. e.g.: 01-01-2013 01:01:01 i tried following pattern: ^[0-12]{2}-[0-31]{2}-[0-9]{4} [0-23]{2}:[0-59]{2}:[0-59]{2}$ but above pattern fails on timestamps like: 09-05-2013 19:45:10 . http://rubular.com/r/egbahwincr i understand may not correct approach validate date time this, want know wrong above. the problem when checking "ranges", example [0-12] @ beginning. character class, , telling regex match 0 through 1, , 2. if added more numbers in after 1st one, isn't working expecting. changing regex (focused on [0-12] initial), [0-319]{2}-[0-12]{2}-[0-9]{4} [0-23]{2}:[0-59]{2}:[0-59]{2}$ , match 09-01-2011 11:11:10 . ensuring there valid numbers each of spaces requires little thinking outside box. regex: (0[1-9]|[12][\d]|3[0-2])-(0[1-9]|1[0-2])-[\d]{4} (0[1-9]|1[\d]|2[0-...

c# - Issues with managing DataGridView rows -

a quick introduction source of problem: i have datagridview that's child of resizable panel , can adjusted user's mouse input. when panel resized, datagridview 's size mirrored along it. idea that, instead of columns , rows of grid auto-sizing fit contents of cells or gridspace, number of columns , rows determined size of grid. width , height of rows , columns pre-determined , don't need adjusted. point of let user adjust row , column quantity. best demonstrated short clip of code in action: resizing panel to accomplish this, check if panel resizing, and, depending if it's shrinking or growing, columns adjusted accordingly. there's magic going on here, looks this: if(panel_width_is_growing) { if(margin >= growing_threshold) { datagridviewcolumn column = new datagridviewcolumn(); column.name = "run " + (datagridview.columns.count + 1).tostring(); column.headertext = "run " + (datagridview.columns...

iphone - Invalid Application Binary -

today received feedback our submission , not understand reported problem: "apps not permitted access udid , must not use uniqueidentifier method of uidevice. please update apps , servers associate users vendor or advertising identifiers introduced in ios 6.". we know rejections udid, our app not use this! after read this, our team reevaluated app , not found occurrences "uidevice uniqueidentifier". revised used libraries , not find call udid. someone have ideas? after research, executed "greap" command: my-app-directory $ grep -rnis 'uniqueidentifier' * binary file john.xcodeproj/project.xcworkspace/xcuserdata/franz.xcuserdatad/userinterfacestate.xcuserstate matches binary file john.xcodeproj/project.xcworkspace/xcuserdata/mahendra.xcuserdatad/userinterfacestate.xcuserstate matches binary file john.xcodeproj/project.xcworkspace/xcuserdata/pareshrathod.xcuserdatad/userinterfacestate.xcuserstate matches binary file john.xcodeproj/pr...

angularjs - ng-show is not working within HAML template on Internet Explorer 7 -

i have following minimum failure case: %span.add-on - if planned_date.blank? %i.icon-calendar - else if successful %i.icon-calendar.foo {{showpopup}} .foo-popup(ng-show='showpopup') show succesful and directive: mymodule.directive.foodirective = -> restrict: 'c' link: (scope, element, attrs) -> scope.showpopup = true myapp.mymodule.directive 'foo', [mymodule.directive.foodirective] this behaves expected in firefox, safari, chrome, opera, , ie8+, displaying styled popup words "show succesfull underneath icon, , words if succesfull above it, interpolating showpopup true . however, in ie7 displays "if successful" above icon, , interpolates showpopup true , not display popup (same behaviour in ie10 ie7 standards mode , browser mode: ie7). what's causing this? , how can fix (absolutely minimal use case) ie 7? thanks! ...

python - Iterating over Numpy matrix rows to apply a function each? -

i want able iterate on matrix apply function each row. how can numpy matrix ? use numpy.apply_along_axis() . assuming matrix 2d, can use like: import numpy np mymatrix = np.matrix([[11,12,13], [21,22,23], [31,32,33]]) def myfunction( x ): return sum(x) print np.apply_along_axis( myfunction, axis=1, arr=mymatrix ) #[36 66 96]

c# - Menu open event -

i have wpf menu add items programatically. consist of couple of menuitems. however, in 1 of menuitems add listbox.(i needed scroller because have many items , made easy). the menu looks fine , works. problem after select (click on) on listbox menu closes expected; if move mouse on it, menu pops open. i have searched on internet no luck not surprising since pretty custom stuff. the last thing tried checking events , see if can handle them. can detect mouseover . not see popopen or onclick event menu. any ideas if can detect these events? other ideas, suggestions appreciated. , if there way add scroller bunch of menuitems may change design well.

function - C++ Lookup of i changed for ISO -

i have following code dictionary. void dictionary::translate(char out_s[], const char s[]) { (int i=0;i<numentries;i++) { if (strcmp(englishword[i], s)==0) break; } if (i<numentries) strcpy(out_s, elvishword[i]); which gives me error name lookup of changed iso , mentions code accepted if use -fpermissive . if try , initialize variable outside loop generates whole load of errors. any ideas? thanks in advance. not "for iso" (perhaps read entire error message... ), iso c++. problem scope of i variable for loop (since definition inside initialization of loop). since seems want use outside loop, declare so: int i; (i = 0; < foo; i++) { // ... } do_safe_stuff_with(i); // valid

Which database to use when developing a desktop application using java -

please suggest me use best database when developing desktop application using java. i planning develop student information system want store , retrieve student information. using java swing develop system. can suggest me best db use application. "best" incredibly subjective, let's narrow down other criterion lightweight , integrated. in category choose h2 , hsqldb or apache derby . these systems written in java can integrate them straight application without need install, set , maintain server, make distribution , setup easier, , have decent feature set , performance. ease of use end users that's simple get. the h2 webpage contains small comparison stable can select "best" fit requirements.

Spring LdapAuthentication and Load roles from local database -

i have spring security configured authenticate against ldap server. <security:authentication-manager > <security:ldap-authentication-provider user-dn-pattern="uid={0}" /> </security:authentication-manager> after authentication want load roles local database same user. how can load local database roles using "ldap-authentication-provider"? if add second authentication provider below: <security:authentication-manager > <security:ldap-authentication-provider user-dn-pattern="uid={0}" /> <security:authentication-provider ref="daoauthenticationprovider" /> </security:authentication-manager> daoauthenticationprovider added, spring not use second provider when first auth provider authenticates user. if first auth provider fails authenticate goes next in list. so have customize <security:ldap-authentication-provider user-dn-pattern="uid={0}" /> to load rol...

java - Mapping multiple collections in one entity in Hibernate -

i quite new hibernate , programming databases in general honest... i've tried save graph-like structure database. suppose have java class this: public class user { @onetomany(cascade=cascadetype.all) private collection<user> followers = new arraylist<>(); @onetomany(cascade=cascadetype.all) private collection<user> friends = new arraylist<>(); @id private string name; ..... } the problem want save postgesql database using hibernate. found quite nontrivial. 1 problem example is: suppose do: user user1 = new user("user1"); user user2 = new user("user2"); user1.getfollowers().add(user2); user1.getfriends().add(user2); now if merge on user1 object there issue key uniqueness constraint. wonder if issue because misconfigured hibernate annotations save structure or entirely wrong approach represent graph in such way using hibernate ? appreciated. personally go generated id column, , not use user...

python - Link Fetching List -

so i've asked many questions regarding 1 subject, , i'm sorry. it. so have code: import urllib import urllib.request bs4 import beautifulsoup import sys collections import defaultdict m_num=int(input('enter number of monsters up: ')) x in range(m_num): name=input("enter monster's name: ") url_name=name.replace(' ','_') url=('http://yugioh.wikia.com/wiki/card_tips:{}'.format(url_name)) page = urllib.request.urlopen(url) soup = beautifulsoup(page.read()) content = soup.find('div',id='mw-content-text') links = content.findall('a') link_lists = defaultdict(list) link in links: link_lists[x].append(link.get('title')) all_lists = list(link_lists.values()) common_links = set(all_lists[0]).intersection(*all_lists[1:]) print('common links: ',common_links) what i'm trying how many number of monsters user specifies how many lists creatd. each lis...