Posts

Showing posts from August, 2014

Python continue from the point where exception was thrown -

hi there way continue point exception thrown? eg have following psudo code unique code 1 unique code 2 unique code 3 if want ignore exceptions of of unique code statements have this: try: #unique code 1 except: pass try: #unique code 2 except: pass try: #unique code 3 except: pass but isn't elegant me, , life of me can't remember how resolved kind of problem last time... want have like try: unique code 1 unique code 2 unique code 3 except: continue last exception raised updated: reason: reason asking above 3 lines of code share same kind of exceptions, lets say, extract information array, , in particular scenario don't care exception of value not in array. wrap each of code sections function , try calling each in for-loop: def code1(): #unique code 1 def code2(): #unique code 2 def code3(): #unique code 3 section in [code1, code2, code3]: try: section() except: pass edit: if still look...

if statement - jquery is checked on radio button -

so, have 3 radio buttons: <input type="radio" name="status" value="enabled" class="radio" <?php if($news_row['status']==1) echo 'checked'; ?> /> <input type="radio" name="status" value="disabled" class="radio" <?php if($news_row['status']==2) echo 'checked'; ?> /> <input type="radio" name="status" value="timer" class="radio" <?php if($news_row['status']==3) echo 'checked'; ?> /> and i'm trying check if radio button value timer checked so if($('.radio [value=timer]').is(':checked')) { console.log('timer'); } but i'm doing wrong since code above doesn't work. so, right way it? using .change() ? demo http://jsfiddle.net/m4m57/5/ issue space here f ($('.radio [value=timer]').is(':checked')) { ...

Google App Engine Channel API MESSAGE QUEUES -

if client connected , disconnects - connection lost 5 mins; server queue messages can't delivered? on local development server seems case? if case in production - how long messages queued for? thanks in production messages dropped if server receives /_ah/channel/disconnected/ post. in practice there's tiny bit of caching. if eg. lose connection briefly because wifi connection drops, message sent during time queued , delivered. shouldn't disconnect post in case.

sql - Access 2010 Query Confusion -

just need quick clarification i have 2 queries in access database should return inverse results: select equipment.title equipment (((equipment.[equipmentid]) not in ( select equipmentid downperiod update null ))); the 2nd excludes not before in. confusion comes fact query posted above not return results if equipmentid field has @ least 1 null value in downperiod table. it works fine if fields filled, , inverse query list works. makes me think there's issue null value. now field should never null wanted know if still work in unlikely event null did occur. thank in advanced! try joins: select equipment.title equipment inner join downperiod on equipment.equipmentid = downperiod.equipmentid downperiod.update null and select equipment.title equipment inner join downperiod on equipment.equipmentid = downperiod.equipmentid downperiod.update not null see if change in syntax fixes issue. not should work, believe faster practise using in() no...

ipad - How to preselect the mail account in iOS MFMailComposeViewController? -

i know there no method in ios setting from: address header in mfmailcomposeviewcontroller http://developer.apple.com/library/ios/#documentation/messageui/reference/mfmailcomposeviewcontroller_class/reference/reference.html#//apple_ref/occ/cl/mfmailcomposeviewcontroller . however, can't believe not possible since ios version 3. is there offical way in ios configure mailcomposer specific mail account? the business requirements app are: send email using (or reply-to) address depending on recipients properties. default mail accounts predetermined in ios settings. there no way programmatically select mail account send mail from.

ruby on rails - How do I put API data into a model? -

currently using last.fm api return concert data (returns hash) in controller, , in view cycling through hash return data want. want concert data become more dynamic , put model. how do this? should in controller or somehow in model? here example of code # app/controllers/events_controller.rb class eventscontroller < applicationcontroller def index @events = @lastfm.geo.get_events("chicago",0,5) respond_with @events end end # app/views/events/index.html.erb <% @events.each |event| %> headliner: <%= event["artists"]["headliner"] %> <% end %> in example would want , event model headliner parameter, , put 5 of events model. i believe idea have model. there several advantages can see 1 - access data oo way other objects 2 - if have business logics (ex: calculations) in model out messing view 3 - clean , dry example model class (this not working model, give u idea :)) class event attr_accessor...

elisp - Can I limit the length of the compilation buffer in Emacs? -

is possible limit number of lines emacs compilation buffer stores? our build system can produce 10,000 lines of output on whole product builds, if no errors encountered. since compilation buffer parses ansi colors, can very, slow. have e.g. 2,000 lines of output buffered. it appears comint-truncate-buffer works compilation buffers shell buffers: (add-hook 'compilation-filter-hook 'comint-truncate-buffer) (setq comint-buffer-maximum-size 2000) i tested running compile command perl -le 'print 1..10000' . when done, first line in compilation buffer 8001 .

With C++ and QT, how do I display a 16-bit raw file as an image? -

i looking display heightmaps video game battlefield 2 images in application. new c++ , qt , might straight forward having trouble displaying grayscale 16-bit 1025x1025 2101250 bytes image. there no header file. need access displayed pixels (does not have pixel perfect precision) can point pixel , value. what have tried i have loaded binary data qbytearray qfile , have attempted use qimage::fromdata function make image making lot of mistakes , spending lot of time not getting far. hope posting here give me clue(s) need progress. here code: void learningbinaryreader::setupreader() { qdebug("attempting open file.."); qfile file("heightmapprimary.raw"); if (!file.open(qfile::readonly)) { qdebug("could not open file"); return; } else { qdebug() << file.filename() << " opened"; } qbytearray data = file.readall(); file.flush(); file.close(); qdebug() << data.cou...

iphone - Getting Facebook account details -

i using sharekit facebook , twitter , facebook account details user id,profile name etc.please give suggestions , help.i had got details before not able retrieve it. please find code below, if ([[nsuserdefaults standarduserdefaults] objectforkey:@"kshkfacebookuserinfo"]){ nsdictionary *facebookuserinfo = [[nsuserdefaults standarduserdefaults] objectforkey:@"kshkfacebookuserinfo"]; fbuseremail = [facebookuserinfo objectforkey:@"email"]; nslog(@"fbid-- %@",fbuseremail); } if ([[nsuserdefaults standarduserdefaults] objectforkey:@"kshkfacebookuserinfo"]){ nsdictionary *facebookuserinfo = [[nsuserdefaults standarduserdefaults] objectforkey:@"kshkfacebookuserinfo"]; fbusername = [facebookuserinfo objectforkey:@"name"]; nslog(@"fbname-- %@",fbusername); } now gets crashed facebookuserinfo null. i have...

c# - Sorting a datatable affects reference datatable -

i have method similar 1 written bellow(this pseudo-code working in c#): function generatechart(datatable dt) { datatable dtcharttable = dt; dtcharttable.defaultview.sort = "somecolumnname"; //remaining functionality } what above code sorts records in dt. not getting why doing so. note: function called 2 different places. @ 1 place sending datatable object , @ other datatable directly refered 1 stored in session. that's right. setting dtcharttable variable same memory represented dt variable. so, sorting dtcharttable affects same defaultview property used second . if don't want behavior create copy of dt using datatable dtcharttable = dt.copy(); but costly because in way every datarow duplicated. possibility creating new dataview dataview view = new dataview(dt); view.sort = "somecolumnname"; ...... this doesn't affect original dt.defaultview , can process datarowview new dataview

c# - How do invoke AddPath()? -

i have following function: public void addpath(string full_path) { treeview tree_view = thetreeview; string[] split_path; treenodecollection current_nodes; if (tree_view == null) return; if (string.isnullorempty(full_path)) return; split_path = full_path.split(tree_view.pathseparator.tochararray()); current_nodes = tree_view.nodes; (int32 = 0; < split_path.length; i++) { treenode[] found_nodes = current_nodes.find(split_path[i], false); if (found_nodes.length > 0) { current_nodes = found_nodes.first().nodes; } else { treenode node; node = new treenode(); node.name = split_path[i]; // name same thing key node.text = split_path[i]; current_nodes.add(node); current_nodes = node.nodes; ...

php - OpenCart boxed products -

i trying implement concept in user can choose among selection of products, , create boxed compilation of products. products included in box won't have price, box have price (fixed one, regardless of selected products), , more precise, user pay box via subscription. user pay 3/6/12 months subscription , able create 3/6/12 compilations of products, 1 each month. can implemented via configuration? can create product, fixed price, , set items, options product? so, in case, box product, price fixed, has no price, user must have paid subscription, , options items user can include in box. on checkout, need add check if user has paid subscription , other checks, found in post: opencart subscription model (x months) any ideas? feasible, , if so, how high, architectural, point of view? cheers, iraklis if create single product box, create options products offering selection yes can done using opencart. recommend use check boxes options, though if want limit number s...

Images in a contenteditable div not deletable -

i'm having little inline editor uses contenteditable div. if have this: http://jsfiddle.net/6psj4/1/ possible make image not deletable? <div contenteditable="true">hi<img src="http://tinyw.in/bh9v" contenteditable="false"></div> worked me on firefox , chrome, it's not usable - e.g. moving caret after image wasn't possible without ecitable content after it. afaik without custom delete key handler , bogus brs/spaces corrections won't possible implement e.g. ckeditor. check this: http://nightly.ckeditor.com/7529/_samples/placeholder.html

android - View not attached to window manager (whats the solution?) -

i got hundreads of error reports app , of them same. annoying because in test devices (htc wildfire, galaxy s i-ii-iii, galaxy mini, galaxy tab 10) error never occured, neither me or test buddy, looks users different us. because of cant give information situation, there 1 thing see, dialog's dismiss, never calls code. here error: java.lang.illegalargumentexception: view not attached window manager @ android.view.windowmanagerimpl.findviewlocked(windowmanagerimpl.java:587) @ android.view.windowmanagerimpl.removeview(windowmanagerimpl.java:324) @ android.view.windowmanagerimpl$compatmodewrapper.removeview(windowmanagerimpl.java:151) @ android.app.dialog.dismissdialog(dialog.java:328) @ android.app.dialog$1.run(dialog.java:119) @ android.app.dialog.dismiss(dialog.java:313) @ android.app.dialog.cancel(dialog.java:1113) @ hu.kulcssoft.ingyenkonyv.reader.reader$javascriptinterface$1.run(reader.java:199) @ android.os.handler.handlecallback(handler.java:605) @ android.os.handler....

iis 7 - CreateProcessAsUser in user session (other than 0) from service (IIS 7) -

my setting is: windows server 2008, iis 7 what accomplish: iis 7 receives request website 3d operations (in wpf) , in end iis 7 should render image , store somewhere on disk loaded website what know , have tested yet: iis 7 runs service in session 0 on windows server 2008 no service in session 0 has access video driver, no service in session 0 can perform rendering tasks (explained here: session 0 isolation ) microsoft proposes in paper create process in user session (by createprocessasuser) perform rendering sucessfully. what achieved until now: logonuser works well createprocessasuser works well the (but important) part doesn't work: when logon username , password , create process user, process still in session 0 , therefore rendering fails. user logged on (i checked it). according microsoft must possible create process in user session (not session 0). how can create process user in other session 0? do have create new session myself or this? ...

clojure - Open a client's plain text file on an HTML page -

how use html open file on client's machine plaintext (i.e., .cpp, .txt, or .html file)? want extract plain textfile user's machine html <textarea> . fyi, using hiccup, clojure, , webnoir generate html , server other options use process along. you have 2 main options: upload file server served html content or use html 5's file api . this question addresses few more options (like applets, enabling drag-and-drop file api, etc.) upload file have users choose file using <input type="file" .../> on 1 page upload file contents server. redirect different page show file contents serve uploaded file's contents in textarea on page. pros : this method pretty simple , straightforward. you can scan file , heavy processing on server cons : trips server can time consuming. html 5 solution have user choose file using <input type="file" .../> instead of posting contents, use javascript load file html 5 ...

perl - equal in if statement not working as expected -

use text::diff; $count; our $stats2 = 0; for($count = 0; $count <= 1000; $count++){ $data_dir="archive/oswiostat/oracleapps.*dat"; $data_file= `ls -t $data_dir | head -1`; chomp($data_file); while(defined($data_file)){ print $data_file; open (dat,$data_file) || die("could not open file! $!"); @stats1 = stat $data_file; @raw_data=<dat>; close(dat); print "stats1 :$stats1[9]\n"; sleep(5); print "checking $stats1[9] equals $stats2\n"; if(chomp($stats1[9]) != chomp($stats2)){ print "i here"; @diff = diff \@raw_data, $data_file, { style => "context" }; print @diff || die ("didn't see updates $!"); } $stats2 = $stats1[9]; print "stat2: $stats2\n"; } } output [oracle@oracleapps osw]$ perl client_socket1.pl archive/oswiostat/oracleapps.locald...

c# - Trying to get a string that represents a class heirachy -

class base { } class a: base { } class b:a { } i want able instance of b string "base.a.b" of course do class b:a { const string name = "base.a.b"; } but thats kind of fragile, if change things have change in many places i started out with class base { protected string name {get{return typeof(base).name;}}; } with dea of each class hierarchy level calling base.name method. again have had name base twice (admittedly fail @ compile time if forget) still seems fragile. same code others, went effort, going damn post (the difference didn't want ".object" stuck on end). public class class1 { } public class class2 : class1 { } public class class3 : class2 { } private void button1_click(object sender, eventargs e) { class3 c3 = new class3(); console.writeline(typetostring(c3.gettype())); } private string typetostring(type t) { if (t == null) return "...

performance - ADO.NET Entity OrderBy VS. View Order By? -

recently doing ado.net entity programming, noticed each entity has orderby method, consider performance, should create view order by in database rather use orderby in entity? in thought, entity return resultset database memory first sort, view database sort on database level , return sorted resultset back. if in case, second way better, right? correct me if wrong :-) thanks. i have limited experience entity framework order by not work in views (see this post ). there appears great information regarding entity framework best practices here . may using sql profiler see queries executed @ runtime run against sql server or using entity framework profiler described in this article .

c# - Why I am allowed to place and amp in this code? -

i have sample code: directoryentry _entry = new directoryentry( connectionstring, this.userprinicipalname, this.password, authenticationtypes.securesocketslayer & authenticationtypes.encryption); how come allowed make amp in last parameter? use java have never seen kind of witchcraft before , new c# - can tell me , how allowed it? thanks in advance nobody else has pointed out, but authenticationtypes.securesocketslayer & authenticationtypes.encryption is bit weird because securesocketslayer , encryption both 2. so might put 1 or other, not both... if were different , did want combine them, should use or operator, |, not , operator, &.

javascript - How to modify XML with JQuery -

i trying modify status flag in xml structure using javascript. using examples found on internet believe should work: test = "<?xml version='1.0' encoding='utf-8' standalone='no' ?>" + "<resultaat>" + "<type>6</type>" + "<status>i</status>" + "<start_datum>2012-06-16 00:00:00</start_datum>" + "<eind_datum></eind_datum>" + "</resultaat>" to change content of status field: $(test).find("status").text("d") the result test not modified , still contains old status i thanks answers the correct insight need convert xmlobject first , modify this. below how ended doing it: /* convert text xml object */ doc = $.parsexml(test) /* change fields required */ $(doc).find('status').text('d') /* text */ str = (new xmlserializer()).serializetostring(...

Horizontal submenu with wordpress -

i'm using wordpress 3.4.1, , headway theme. i'm not sure if headway messing i'm hoping can point me in right direction. the basic request - submenu displays horizontally when hover or click on main menu item. here's html (the block ids , lots of code inserted headway): <nav id="block-10" class="custom_yap_menu block block-type-navigation block-fluid-height block-mirrored block-mirroring-10 block-original-97"> <div class="block-content"> <div class="nav-horizontal nav-align-center"> <ul id="menu-yap-menu" class="menu"> <li id="menu-item-750" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-750"> <a href="#" title="solutions">solutions</a> <ul class="sub-menu"> <li id="menu-item-764" class="nav2 menu-item menu-item-type-post_type menu-item-object-page menu-item-764...

colors - What is high performance for creating a TIF image from a background TIF and a foreground TIF in java -

i have 2 tif files, 1 background (overlay) , other foreground. following code used combining 2 tifs. // background color of foreground image int w = color.white.getrgb(); // fill pixels not background color (int = 0; < foregroundimage.getwidth(); i++) { (int j = 0; j < foregroundimage.getheight(); j++) { int x = foregroundimage.getrgb(i, j); if (x != w) backgroundimage.setrgb(i, j, x); } } is there other way has better performance this? you can make color.white pixels transparent using rgbimagefilter , shown here , or lookupop , mentioned here . can use alphacomposite.src_over rule combine images. alphacompositedemo example lets 1 explore available modes, , there's related example here . of course, you'll need profile both approaches see faster.

java - How to include rmic package jar in maven assembly -

i have multi-module maven project must have rmi stubs generated (to integrate legacy product can't use dynamic proxies). have configured rmic-maven-plugin rmic during compile phase, , package stubs jar during package phase. <execution> <id>rmic-process-classes</id> <goals> <goal>rmic</goal> </goals> <phase>compile</phase> <configuration> <keep>true</keep> <!--outputdirectory>${project.build.outputdirectory}</outputdirectory--> <includes> <include>com.myimpl</include> </includes> </configuration> </execution> <execution> <id>rmic-package</id> <goals> <goal>package</goal> </goals> <configuration> <!--outputdirectory>${project.build.outp...

osx - How to test if the mouse is inside a specified window? -

with cocoa, how check if mouse inside specified window of mine? have following code detects if it's within bounds of window, incorrectly prints it's inside if window closed/hidden mouse still in rectangle. incorrectly it's inside if window on top of it, mouse within region of window i'm testing below it. nspoint mouse = [nsevent mouselocation]; bool mouseinside = nspointinrect(mouse, self.window.frame); if (!mouseinside) { nslog(@"mouse isn't inside"); } else { nslog(@"mouse inside"); } i've tried this: while ((screen = [screenenum nextobject]) && !nsmouseinrect(mouse, [screen frame], no)); if (screen != self.window.screen && mouseinside) { nslog(@"mouse inside."); } but print "mouse inside". any ideas? or setting tracking area way? mikeash on freenode pointed me nswindow's windownumberatpoint: the following code appears work needed: if ([nswindow windownumbe...

How to display the number of posts per each categories in WordPress? -

i need display number of posts per each category in wordpress theme. should appear that: cat1 (5) cat2 (3) cat3 (2) the number number of posts, 5 means 5 articles in cat1, etc.... i write following code:- <ul> <?php wp_list_categories( 'orderby=name & title_li' ); ?> </ul> so should add display number of posts per each category? just add show_count option: <?php wp_list_categories('orderby=name&title_li=&show_count=1'); ?> there plenty more options if want customise output further: wp_list_categories on wordpress codex

jquery - JPlayer + MVC3 + IE9 -

i cant jplayer work in ie9. examples work in (ie9 asks allow activation of active x controls first). when try reproduce examples in mvc3 app, doesnt play video. know question has been asked many times cant seem solve problem (in context of mvc3 app) "solution" attribute jplayer. think im missing dont know is. same result mediaelement.js. anybody knows issue? i make work in published version configuring mime types in iis. added mime types mp4 format.

java - Save Image Byte Array to .net webservice and retrieve it -

i have .net asmx webservice i'm consuming using ksoap2 library. in service, first save user image , later retrieve it. however, once retrieve it, byte array intact, bitmapfactory unable decode , returns null. to convert byte array: bitmap viewbitmap = bitmap.createbitmap(imageview.getwidth(), imageview.getheight(), bitmap.config.argb_8888); bytearrayoutputstream bos = new bytearrayoutputstream(); viewbitmap.compress(compressformat.png, 0 /* ignored png */, bos); byte[] bitmapdata = bos.tobytearray(); the webservice accepts bytearray in byte[] format. to convert array bitmap: byte[] blob= info.get(main.key_thumb_bytes).getbytes(); bitmap bmp=bitmapfactory.decodebytearray(blob,0,blob.length); // return null :( imageview.setimagebitmap(bmp); from partial-analysis, appears byte array not change. why decoding return null? there better save image , pass through webservice? didn't analyze whole byte array, i'm guessing might've changed bit. any thoughts? ...

java - xmlreader do not run the startelement method -

i have problems xmlreader. can run , url correct have not run startelement method. value returned null. want know why happen , soludtion. thank you! package com.headfirstlabs.nasadailyimage; import java.io.ioexception; import java.io.inputstream; import java.net.httpurlconnection; import java.net.url; import java.net.unknownhostexception; import java.util.jar.attributes; import javax.xml.parsers.saxparser; import javax.xml.parsers.saxparserfactory; import org.xml.sax.inputsource; import org.xml.sax.saxexception; import org.xml.sax.xmlreader; import org.xml.sax.helpers.defaulthandler; import android.graphics.bitmap; import android.graphics.bitmapfactory; import android.os.strictmode; public class iotdhandler extends defaulthandler { private string url = "http://www.nasa.gov/rss/image_of_the_day.rss"; private boolean inurl = false; private boolean intitle = false; private boolean indescription = false; private boolean initem = false; private b...

javascript - JQuery hiding a dropdown menu when clicking another element -

i have following html create dropdown menu: <li class="user-section user-section-original"> <img class="user-image" src="{{ user.get_profile.avatar_small.url }}" height="30" width="30"/> <span class="name">{{ user.first_name }} {{ user.last_name.0}}.</span> </li> <li class="user-section-dropdown user-section hidden"> <img class="user-image" src="{{ user.get_profile.avatar_small.url }}" height="30" width="30"/> <span class="name">{{ user.first_name }} {{ user.last_name.0}}.</span> <a href="{% url logout %}" class="dropdown-item">log out</a> </li> when user clicks menu, dropdown, , if user clicks again (or clicks anywhere outside of dropdown menu), hide again. here have far: $("#header li.user-section").click(function() { $("#hea...

.net - TabControl DockStyle : Fill -

i have tabcontrol , when choose dockstyle: fill , begins fill 0,0 on whole parent. how change coordinats dockstyle: fill ? i work visual studio 2010. you can't. fill means that;; fill available space. instead, can anchor 4 sides. if you're trying put control next it, dock control 1 side. (you may need send back)

tabcontrol - Any example of changing menus and supporting closing for an 'AllActive' tabbed application? -

i'm cm newbie , trying head around cm. building application each tab allows user different functionality accessing server active work in tabs (if active) running async each other shell "conductor.collection.allactive" hope correct choice. looking suggestions or sample in 2 areas - i have main shell own application menu , tab control, , change application menuitems depending on tab selected , have menuitem clicks routed respective vm tab. since tabs potentially doing active work simultaneously, hoping example of how vm on each tab can participate in helping decide (via dialogs user) if application can closed if close menuitem or application x icon clicked. or if close should cancelled per user response (e.g. 'no' since there unsaved files). any examples , suggestions appreciated. i created sample of possible way this. using sharedviewmodel contains collection of menuitems . sharedviewmodel injected shellviewmodel , each tabviewmodel . me...

package - How to find Lines of Code of packaged procedures and functions in Oracle -

possible duplicate: how view oracle stored procedure using sqlplus? im new oracle. please me on this? how fine lines of code of packaged procedures , functions in oracle? is there system tables or query find loc of procedures , functions inside package? check out all_source view in oracle dictionary.

iphone - How to add a UIview above the current view controllers view? -

i have ipad application in trying barcode reading processes.when pressing button in home page presenting barcode reading viewcontrollers view this` zbarreaderviewcontroller *reader = [zbarreaderviewcontroller new]; reader.readerdelegate = self; reader.supportedorientationsmask = zbarorientationmaskall; reader.sourcetype=uiimagepickercontrollersourcetypecamera; //reader.cameradevice = uiimagepickercontrollercameradevicefront; reader.cameraoverlayview=cameraoverlay; if( [uiimagepickercontroller iscameradeviceavailable: uiimagepickercontrollercameradevicefront ]) { reader.cameradevice = uiimagepickercontrollercameradevicefront; } zbarimagescanner *scanner = reader.scanner; reader.wantsfullscreenlayout = yes; // todo: (optional) additional reader configuration here // example: disable used i2/5 improve performance [scanner setsymbology: zbar_i25 config: zbar_cfg_enab...

jquery - limit Google maps of countries in the autocomplete list to "INDIA, USA and UK" -

this code not working. please tell me exact solution <script src="maps.googleapis.com/maps/api/…; type="text/javascript"></script> <script type="text/javascript"> function initialize() { var input = document.getelementbyid('searchtextfield'); /* restrict multiple cities? */ var options = { types: ['(cities)'], componentrestrictions: {country: ["usa", "uk"]} }; var autocomplete = new google.maps.places.autocomplete(input, options); } google.maps.event.adddomlistener(window, 'load', initialize); </script> first of all, cannot filter multiple countries. it's known issue reported here . then code, have use 2 characters string country code : componentrestrictions can used restrict results specific groups. currently, can use componentrestrictions filter country. country must passed as 2 character, iso 3166-1 a...

android - Select item in ListView crashes program -

i have listview allows me able select picture , working fine problem when select other pictures crushes , error message not understand , these pictures mysql database. the content of adapter has changed listview did not receive notification. make sure content of adapter not modified background thread, ui thread. [in listview(16908298, class android.widget.listview) adapter(class car.store.carstore.mobilearrayadapter)] thanx in advance. myadapter looks this public class mobilearrayadapter extends arrayadapter<string> { private final context context; private final string[] mycarlist = null; private arraylist<string> mycar = new arraylist<string>(); private arraylist<string> carimageurl = new arraylist<string>(); //arraylist<hashmap<string, string>> mycarlist = new arraylist<hashmap<string, string>>(); //arraylist<hashmap<string, string>> carimageurl = new arraylist<hash...

iphone - Find the position of subview in a View -

goal : how can find position of subview in view. wants find out upper left (x,y)position of scrollbar in view, using navigation bar in application effect on positioning of subviews top? i know how find height , width of subview cgsize viewsize = scrollview.frame.size; height=viewsize.height; width=viewsize.width; what you're looking probably: cgpoint viewposition = scrollview.frame.origin; x=viewposition.x; y=viewposition.y; but if you're looking translate view's coordinate system, use: - (cgpoint)convertpoint:(cgpoint)point toview:(uiview *)view and pass point , view wish translate.

Speeding up the insertion of formulas via xlcFormula via Excel-DNA -

i using excel-dna insert formulas 40k rows * 10 columns, , quite slow. xlcall.excel(xlcall.xlcformula, myformula, new excelreference(row, row, column, column)); i managed improve dramatically temporarily disabling recalculation of cells on update ( xlcall.excel(xlcall.xlccalculation, 3); ), ideally find way put entire column of formulas excel in single operation (i assuming improve speed). i tried passing object[,] call xlcformula: xlcall.excel(xlcall.xlcformula, excelformulas, new excelreference(1, lastrow, columnnumber, columnnumber)); but put formulas single field (separated semicolons). there way trying do, or wasting time on impossible? you try screen updating switched off xlcall.excel(xlcall.xlcecho, false) . what using clipboard ? copy formulae (with tabs between columns) clipboard, , paste @ once excel sheet. fast excel process formula strings.

Android: wrap_content is not working with ListView -

i working on android. want list view wrap content horizontally , not fill width. wrap_content properties not working. do? as romain guy (google engineer works on ui toolkit) said in post by setting width wrap_content you telling listview wide widest of children. listview must therefore measure items , items has call getview() on adapter. may happen several times depending on number of layout passes, behavior of parent layout, etc. so if set layout width or layout height of listview wrap_content listview try measure every single view attached - not want. keep in mind: avoid setting wrap_content listviews or gridviews @ times, more details see google i/o video talking world of listview

javascript - Problems with Extjs.getBody -

i have line of code var width_client = ext.getbody().getwidth(true); and ext.getbody() null. asume check doen before ext.getbody() becames not null, dont' know or change. any idea how solve this? i use extjs 4.0.7 you can access document.body when rendered. question made conclusion code located inside <head> . when code executed there no <body> rendered yet. have wrap code function , pass function ext.onready (or ext.ondocumentready ) method: ext.onready(function() { alert(ext.getbody().getwidth(true)); }); here demo .

php - Passing $_GET parameters to cron job -

i new @ cron jobs , not sure whether would work. for security purposes thought making 1 page script looks values (a username, password, , security code) make sure computer , knows 3 can run command. i made script , works running in browser possible run cron job values? a example me running * 3 * * * /path_to_script/cronjob.php?username=test&password=test&code=1234 is possible? the $_get[] & $_post[] associative arrays initialized when script invoked via web server. when invoked via command line, parameters passed in $argv array, c. contains array of arguments passed script when running command line. your command be: * 3 * * * /path_to_script/cronjob.php username=test password=test code=1234 you use parse_str() set , access paramaters: <?php var_dump($argv); /* array(4) { [0]=> string(27) "/path_to_script/cronjob.php" [1]=> string(13) "username=test" [2]=> string(13) "password=tes...

php - How can i reuse a variable more efficiently in cakePHP? -

i have code: $getcookiedata = $this->cookie->read('data'); $getuser = $this->user->find('first', array('conditions' => array('user.username' => $getcookiedata['username']))); basically i'm using in lot of locations users information , either show it, compare it, etc. wondering if there more efficient way me use variable around site, instead of repeating myself lot. you can wrap in function: public function getuser() { $getcookiedata = $this->cookie->read('data'); $getuser = $this->user->find('first', array('conditions' => array('user.username' => $getcookiedata['username']))); return $getuser; } and call $this->getuser() . should put in class in context of current value of $this eg in class these functions present. you can make static (eg public static function getuser(){...} ) in case able call directly using clas...

iphone - Change UIView's background color -

Image
i doing exercises delegate, have problem uiview. storyboard i want change color of uiview 3 uisliders. range of uisliders 0 255. , code: colorfield uiview custom class colorfield.h #import <uikit/uikit.h> @protocol colorfielddelegate <nsobject> -(nsarray *)givemecolors; @end @interface colorfield : uiview @property (nonatomic , weak) iboutlet id<colorfielddelegate> delegate; @end colorfield.m #import "colorfield.h" @implementation colorfield @synthesize delegate = _delegate; - (id)initwithframe:(cgrect)frame { self = [super initwithframe:frame]; if (self) { // initialization code } return self; } // override drawrect: if perform custom drawing. // empty implementation adversely affects performance during animation. - (void)drawrect:(cgrect)rect { // drawing code nsarray *arrayofcolors = [self.delegate givemecolors]; int red = [[arrayofcolors objectatindex:0] intvalue]; int green = [[arrayofco...

tsql - designing table for high insert rate -

i sugestion on how design table gets 10 50 million inserts day , needs respond selects... should use indexes? or overhead cost great? edit:im not worried transaction volume... assigment... , need figure out design table "must respond selects not based on primary key, knowing table receive enourmous amount of inserts day-in-day-out" definitely. @ least primary key, foreign keys, , whatever need reporting, don't overdo it. 10k-50k inserts day not problem. if like, don't know, million inserts start thinking of having separate tables, data dictionaries , not, needs wouldn't worry.

c++ - STL to store the numbers in sorted order -

which ideal stl container use in c++ sorted insert integers contain duplicates. if understand possibly std::multiset store duplicates when iterate on container you'll them in sorted order

sql server - Trigger with specific value? -

i've read questions/answers here on stack couldn't find need. let's have following table: col0 col1 col2 col3 col4 ---- ---- ---- ---- ---- 8 1 b c 8 2 b c 8 3 b c 9 1 b c 9 2 b c and software does: insert testtable ([col0],[col1],[col2],[col3],[col4]) values ('8','4','a','b','c') how can create trigger pseudo-code: on insert when col1 = '4' delete existing rows col0 same (8 in case) ** except new row i've added ** it sounds more appropriate perform in instead of trigger. if goal assume: when new row inserted col0 = 8, want delete other rows same key, yes? create trigger dbo.testtable_instead_insert on dbo.testtable instead of insert begin set nocount on; delete t dbo.testtable t inner join inserted on t.col0 = i.col0 i.col1 = '4'; insert dbo.testtable(col0,col1,col2,col...

css - Box-shadow overflow issue -

i have 2 boxes, title , content. using box-shadow on these make them more looking. right now, both shadows visible 1 on top of other. want title shadow not float on content box. if add position: relative title box, content shadow stops floating on title (this want do, other way around). however, trying opposite doesn't work. z-index doesnt seem working. fiddle: http://jsfiddle.net/jr93s/24/ h2 { width: 300px; margin: 20px 0px 0px 20px; padding: 5px 11px 5px 11px; border-radius: 3px; color: #333; background-color: #ccf; box-shadow: 0px 0px 10px 10px rgba(0,0,0,0.5); } div { width: 300px; height: 300px; margin: 0px 0px 0px 20px; padding: 10px 10px 10px 10px; border: 1px solid #999; border-radius: 3px; box-shadow: 0px 0px 10px 10px rgba(0,0,0,0.5); } <h2>title</h2> <div>some stuff here</div> any ideas? thanks! you use inset box-shadows avoid overlap. here, http://jsfiddle.n...

optimization - Saving result of has_one association to avoid fetching DB in Rails? -

i have has_one association between user model , player model. see myself doing current_user.player many times in controllers , views, , feel hitting db way every time that. nice have current_player method. how , define method can access current_player both controllers , views? it's (properly) going reload @ least once each time hit page, can prevent following loads memoizing result: class user has_one :player def current_player @current_player ||= player end end as alternative, possibly include player model in default scope, loads whenever user model loaded: class user has_one :player default_scope includes(:player) end unfortunately, whenever i've tried tend find didn't want auto-loading other table every time, , switch previous method loads 2nd table on first use. memoizing object ivar vastly more flexible.

fckeditor - whick one is better fkeditor or ckeditor? -

i running through problem choose either fkeditor or ckeditor 1 better other in project. , how can tutorial regarding customization of 1 of these editor in php. can name websites thanks. ckeditor formerly known fckeditor (the creator unaware fckeditor didn't sound very... professional) - you'll want ckeditor. the ckeditor website has wealth of information - check out user guide , tutorials , how tos . also, when have downloaded ckeditor file, you'll find example code in ckeditor/_samples/php should help.

MySQL counting without count function? -

database: tennis , ie tennis club. table discussed: penalties columns: paymentno , amount , playerno task: classify penalty amounts high, medium, low - done ! then, count number of penalties in low category - need help. how do part 2 without using count function ? possible ? sql query 1: use tennis; select tennis.penalties.paymentno, tennis.penalties.amount, tennis.penalties.playerno, case when playerno >= 0 , playerno <= 40 'low' when playerno > 40 , playerno < 80 'medium' when playerno > 80 'high' end tennis.penalties; thanks. sum(playerno >= 0 , playerno <= 40) count_penalties_in_low or sum(case when playerno >= 0 , playerno <= 40 1 else 0 end) count_penalties_in_low so technically summarize 1s, in fact equals count ps: playerno >= 0 , playerno <= 40 can rewritten to playerno between 0 , 40 pps: playerno = 80 isn...

c# - Applying align attribute to table header using Jquery -

i know apply css dom using jquery using .css() , want know there .attr or .att method can assign align attribute table header using jquery. if yes please show me code. <table> <th > </th> <th > </th> <th > </th> </table> here sample code $(element).attr("nameattr",valueattr); can add attribute html element

geolocation - Unable to detect user current location on android device -

i developing small android application in want find user current location. code structure detecting user location looks . private void sendsms(context context, intent intent) { final long minimum_distance_change_for_updates = 1; // in meters final long minimum_time_between_updates = 1000; // in milliseconds locationmanager locationmanager; locationmanager = (locationmanager) context.getsystemservice(context.location_service); locationmanager.requestlocationupdates( locationmanager.gps_provider, minimum_time_between_updates, minimum_distance_change_for_updates, new mylocationlistener() ); location location = locationmanager.getlastknownlocation(locationmanager.gps_provider); string loc_message = null; if (location != null) { loc_message =string.format( "current location \n longitude: %1$s \n latitude: %2$s", location.getlongitude(), location.getlatitude() ); ...

javascript - ExtJS undefined function -

i try load store, reason error in google chrome(latest version): uncaught typeerror: cannot call method 'apply' of undefined ext-all-debug.js:8586 fire ext-all-debug.js:8586 ext.define.continuefireevent ext-all-debug.js:24623 ext.define.fireevent ext-all-debug.js:24601 ext.define.onproxyload ext-all-debug.js:50186 ext.define.processresponse ext-all-debug.js:39168 (anonymous function) ext-all-debug.js:39381 ext.apply.callback ext-all-debug.js:6422 ext.define.handleresponse ext-all-debug.js:18769 (anonymous function) ext-all-debug.js:1815 (anonymous function) and 1 in internet explorer 8: message: 'firefn' null or not object while firefox(latest version) seems ignore it. i have inserted new lines in ext-all-debug.js , line numbers may off 5-10 lines. this store: ext.define("fi.store.units.installbasestore", { extend:'ext.data.store', requires: "fi.model.units.installbasemodel", model: "fi.model.units.installb...