Posts

Showing posts from March, 2010

Error inserting data from textbox to sql database in c# -

when try insert value textbox database, values not being updated in database. newly inserted rows temporarily available, after inserting when use select query rows, new rows available. when close solution , open again, newly insert rows gone. table in database explorer not updated. here code. string connectionstring = @"data source=.\sqlexpress;attachdbfilename=|datadirectory|\database1.mdf;integrated security=true;user instance=true"; string na = textbox1.text; int ag = int.parse(textbox2.text); string ci = textbox3.text; using (sqlconnection connection = new sqlconnection(connectionstring)) { using (sqlcommand insertcommand = connection.createcommand()) { insertcommand.commandtext = "insert address(name,age,city) values (@na,@ag,@ci)"; insertcommand.parameters.addwithvalue("@na", na); ...

java - Convert byte [] to ArrayList<Object> -

i have byte [] obtained using object arraylist can tell me how convert byte [] object arraylist? coveting arraylist this bytearrayoutputstream bos = new bytearrayoutputstream(); objectoutputstream oos = null; oos = new objectoutputstream(bos); oos.writeobject(marraylist);//marraylist array convert byte[] buff = bos.tobytearray(); thank you! now you've given information how did conversion 1 way... need: objectinputstream ois = new objectinputstream(new bytearrayinputstream(bytes)); try { @suppresswarnings("unchecked") arraylist<object> list = (arraylist<object>) ois.readobject(); ... } { ois.close(); }

ios - Any way to apply 'webkit-overflow-scrolling: touch' inline with javascript? -

have not been able property show in dom via jquery or native javascript. jquery doesn't seem support , can't find native name/syntax works. help?? with javascript, need replace dash - following capital letter, example: var el = document.getelementbyid('element id'); el.style.webkitoverflowscrolling = 'touch';

sql - Get non duplicates of column x but duplicates of column y -

i have table (call table mytable). it has data this: number / name 1 jake 2 chris 3 sally 4 billy 1 tom 5 cathy (i realize poor setup, didn't luxury of doing setup) i need query table results returned with: 1 jake 2 chris 3 sally 4 billy 5 cathy or 2 chris 3 sally 4 billy 1 tom 5 cathy it not matter name gets returned duplicated number... 1 gets returned. here not-working attempt: with ( select number mytable ), b ( select number, name mytable ) select a."number", b."name" left join b on a."number" = b."number" use group by ensure each number returned once, , use aggregate function pick 1 of values name : select number, max(name) name yourtable group number

java ee - If I use a facade class with generic methods to access the JPA API, how should I provide additional processing for specific types? -

let's i'm making simple web application using java ee specs (i've heard possible). in app, have 10 domain/data objects, , these represented jpa entities. architecturally, consider jpa api perform role of dao. of course, don't want use entitymanager directly in ui (jsf) , need manage transactions, delegate these tasks so-called service layer. more specifically, able handle these tasks in single dataservice class (often called crudservice) generic methods. see article adam bien example interface: http://www.adam-bien.com/roller/abien/entry/generic_crud_service_aka_dao my project differs article in can't use ejbs, service classes named beans , handle transactions manually. regardless, want single interface simple crud operations on data objects because having different class each data type lead lot of duplicate and/or unnecessary code. ideally, views able use method such public <t> list<t> findall(class<t> type) { ... } to retrieve data....

oop - Inheritance vs class instance in python module import -

apologies if doesn't make sense, i'm not of experienced programmer. consider following code: import mymodule class myclass: def __init__(self): self.classinstance = mymodule.classinstance() and ...... from mymodule import classinstance class myclass(classinstance): def __init__(self): pass if wanted use 1 classinstance in myclass, ok import specific class module , have myclass inherit class ? are there best practices, or things should thinking when deciding between these 2 methods ? many thanks allow me propose different example. imagine have class vector. want class point. point can defined vector maybe has other functionalities vector doesn't have. in case derive point vector. now need line class. line not specialisation of of above classes don't want derive of them. line uses points. in case might want start line class way: class line(object): def __init__(self): self.point1 = point() ...

android - How to send push messages to multiple users using C2DM? -

so far have succeeded send messages 1 device using registration id , authtoken signed c2dm role account. have send messages multiple users . dont know how achieve this. could overcome issue. java servlet code, public void doget(httpservletrequest req, httpservletresponse resp) throws ioexception { resp.setcontenttype("text/plain"); stringbuilder data = new stringbuilder(); data.append("registration_id=" + serverconfig.deviceregistrationid_s); // collapse key grouping messages , last sent message // same key going sent phone when phone // ready message if not beginning data.append("&collapse_key=test"); // here message sending, key1 can changed whant // or if whant send more 1 can (i think, not tested // yet), testing message here. data.append("&data.key1=testing message c2dm"); // if want message wait phone not idle se...

comparison - JQuery Compare Table Data -

i have large table of data (that displays test data) separated date. sort data post-processing using jquery (the table built in perl , sorting can't done there). after data sorted date, add separating line between each day. for instance, i'd 5 test runs june 5th, followed blank line (a blank "tr", have data added later that's not important here), followed june 4th runs, blank line, june 3rd runs, etc. here sample of table have: http://jsfiddle.net/pyuz8/1/ here pseudocode have, not sure how in jquery: now = thisdate.substring(0,10) //look @ date, time doesn't matter = previousdate.substring(0,10) if (then != now) insert( "<tr></tr>" ); //inbetween , now how can done in jquery? run through each row, compare current date next date, insert tr after current row if dates differ. this: $('tr').each(function(){ var current_date = $(this).children('.date_cell').val() // or whatever call date...

javascript - Get css value by CSS and use in Selenium -

i try website attribute (colour of cell) , compare in selenium. when put this: javascript:window.getcomputedstyle(document.getelementbyid("simple_cname"),null).getpropertyvalue("background-color"); in chrome omnibox, receive correct answer, when i, using storeeval or asserteval try value not work correctly. edit: put selenium command this. use storeeval , when echo value returns me command. use firefox. used chrome chech if command correct. (it should "rgb(220, 22, 92)" ) edit2: yes, command ok, have problem using in selenium-ide tool. not returns value when use storeeval command. log: [info] script is: var test javascript:window.getcomputedstyle(document.getelementbyid("simple_cname"),null).getpropertyvalue("background-color"); echo test; [info] executing: |echo | ${test} | | [info] echo: var test javascript:window.getcomputedstyle(document.getelementbyid("simple_cname"),null).getpropertyvalue("background-col...

iphone - resize toolbar in UINavigationController -

i'm adding series of buttons uinavigationbar using: nsarray *items; items = [nsarray arraywithobjects: fixedspace, refreshstopbarbuttonitem, flexiblespace, self.backbarbuttonitem, flexiblespace, self.forwardbarbuttonitem, flexiblespace, self.actionbarbuttonitem, fixedspace, nil]; uitoolbar *toolbar = [[uitoolbar alloc] initwithframe:cgrectmake(0.0f, 0.0f, toolbarwidth, 44.0f)]; toolbar.items = items; toolbar.tintcolor = [[uicolor whitecolor] colorwithalphacomponent:1.0]; toolbar.autoresizingmask = uiviewautoresizingflexibleheight; self.navigationitem.rightbarbuttonitem = [[uibarbuttonitem alloc] initwithcustomview:toolbar]; all working well. however when rotate landscape mode toolbar within uinavigationbar doesn't rotate. adding code (found on so) causes toolbar...

mdx - How can I get MIN and MAX values for dimension members in a set that uses NON EMPTY -

i have problem need high , low values set dimension members (not measures) specific intersection (one customer , time period). need reference these report parameters downstream. can find examples pulling min , max measures. need actual dimension values. any ideas? assuming key0 numerical value, : select topcount( [rent range].[rent range floor].members, 1, [rent range].[rent range floor].currentmember.properties( 'key0', typed ) ) + bottomcount( [rent range].[rent range floor].members, 1, [rent range].[rent range floor].currentmember.properties( 'key0', typed ) ) on 0 [sales] otherwise other numerical property fine.

iphone - Windows Azure Toolkit -

i'm trying build , run of example apps included in windows azure toolkit here , can't seem find libwatoolkitios.a required file build. have not modified project in way , assume file should included automatically, how it? how have guys been able compile apps successfully? thanks. the library libwatoolkitios.a not provided download instead need build first, described in doc below: open watoolkit-lib xcode project. compile project release. place .a file , header files somewhere can reference project (for example lets lib).

link to - Making a conditional link_to statement in Rails? -

in code below, i'm trying make that, if user has accepted invite, they'll able click on "not attending" div decline invite. that bit of logic works fine, i'm trying "not attending" div shows regardless of whether user has accepted invite. right now, div appears if user has accepted invite. is there way make link_to statement conditional, preserve div regardless? (that is, make div present, link if user's accepted invite?) <% if invite.accepted %> <%= link_to(:controller => "invites", :action => "not_attending") %> <div class="not_attending_div"> not attending </div> <% end %> <% end %> <%= link_to_if invite.accepted ... %> http://apidock.com/rails/actionview/helpers/urlhelper/link_to_if edit: link_to_if uses link_to_unless uses link_to 's code, should work same same options ...

https://example.com/admin redirects to https://admin in Django Nginx and gunicorn -

the entire application works django + nginx + gunicorn using ssl(in production). when try access django-admin page https://example.com/admin , try login redirects me ( https://admin ). ps: sorry silly question. inputs ? this sounds similar django's httpresponseredirect seems strip off subdomain . and if so, issue either nginx proxy or gunicorn not delivering domain name (http_host) django. verify examining request.meta within django.

Android Lifecycle in Adobe Air -

how events onpause, onresume etc android activity taken care of in adobe air. want when activity paused while developing air app how do it? i read article oliver goldman , http://www.adobe.com/devnet/air/articles/considerations-air-apps-mobile.html . says can use flash.events.event.deactivate event of air keep tab on onpause. more info on - http://help.adobe.com/en_us/air/reference/html/flash/desktop/nativeapplication.html

Why use TAG in most of the Android logging code -

i can see common practice among android developers. public final class taskssample extends listactivity { private static final string tag = "taskssample"; private void method() { log.i(tag, "message"); } } will easier, if way? need not declare tag every new class. public final class taskssample extends listactivity { private void method() { log.i(getclass().getname(), "message"); } } rather writing getclass().getname() @ each place log placed in particular activity, preferred have tag represent name of activity class. why use tag? when running application there might more 1 activity class in it. distinguish activity class has logged information in logcat use tag of course represents name of class. and proper way (i not saying have written wrong) of writing tag is: private static final string tag = taskssample.class.getsimplename(); // , not "taskssample"

php - How to parse SOAP in order to list all Request and Object names -

i'm able parse xml soap when know namespace , request name. because have different kind of soap requests, request name in soap file . extract of part of soap: <?xml version="1.0" encoding="utf-8"?> <soap-env:envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://schema.example.com" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" soap-env:encodingstyle="http://schemas.xmlsoap.org/soap/encoding/" > <soap-env:body> **<ns1:sendmailling>** <campagne xsi:type="ns1:campaign"><activatededup xsi:nil="true"/><billingcode xsi:nil="true"/><deliveryfax xsi:type="ns1:deliveryfax"/> <deliverymail xsi:type="ns1:deliverymail"> ... php code:...

Stream FTP upload in chunks with PHP? -

is possible stream ftp upload php? have files need upload server, , can access server through ftp. unfortunately, can't timeout time on server. @ possible this? basically, if there way write part of file, , append next part (and repeat) instead of uploading whole thing @ once, that'd save me. however, googling hasn't provided me answer. is achievable? ok then... might you're looking for. familiar curl? curl can support appending ftp: curl_setopt($ch, curlopt_ftpappend, true ); // append flag the other option use ftp:// / ftps:// streams, since php 5 allow appending. see ftp://; ftps:// docs. might easier access.

time series - R - Difference between two rows depending on condition -

i have time series ddate=seq(as.posixct("2012/1/1"), as.posixct("2012/1/10"), "day") ddate [1] "2012-01-01 pst" "2012-01-02 pst" "2012-01-03 pst" "2012-01-04 pst" "2012-01-05 pst" "2012-01-06 pst" "2012-01-07 pst" "2012-01-08 pst" "2012-01-09 pst" [10] "2012-01-10 pst" values <- c(f,t,t,t,f,f,t,t,f,f) > dframe <- data.frame(time=ddate,values=values) > dframe time values 1 2012-01-01 false 2 2012-01-02 true 3 2012-01-03 true 4 2012-01-04 true 5 2012-01-05 false 6 2012-01-06 false 7 2012-01-07 true 8 2012-01-08 true 9 2012-01-09 false 10 2012-01-10 false i want know interval during values true ? expected result starttime diff(day) 2012-01-02 3 2012-01-07 2 you can do: with(dframe, data.frame(starttime = time...

methods - PHP __callStatic failing intermittently -

i have simple __callstatic magic method defined in class: public static function __callstatic($method, $args) { if(substr($method, 0, 8) == "require_") { // stuff } } the script dies fatal error "undefined method myclass::require_foo" when executed. however .. if modify file in way, example: public static function __callstatic($method, $args) { if(substr($method, 0, 8) == "require_") { // hello } } it works on next page load. subsequent page loads fail until make change file. this creepy, right? 100% reproducible every time. this problem related opcode caching on server. eaccelerator has known issues __callstatic(). https://eaccelerator.net/ticket/382

is there a file size limit when creating a csv file using php and mysql? -

i attempting create csv file update inventory in magento. code follows: <?php require_once ('../db.php'); $conn = db_connect(); $inventory = array(); $csvcontent = ""; $n=0; $result = $conn->query("select inventory.sku, book.author, book.title, book.publisher, book.pub_date, book.edition, inventory.isbn13, book.binding, book_condition.book_condition, defect.defect, note, feature, inventory.ourprice, inventory.cost, inventory.quantity, subtitle, weight inventory left join book on book.isbn13 = inventory.isbn13 left join defect on inventory.defect_id = defect.defect_id left join note on inventory.note_id = note.note_id left join feature on inventory.feature_id = feature.feature_id left join book_condition on book_condition.condition_id = defect.condition_id inventory.quantity >0"); $num_rows = $result->num_rows; if($num_rows > 0) { while($row = $result->fetch_assoc()) { $inventory[$n] = array('sku' => $row...

php - Timestamp a Variable being returned -

i little slow when comes jquery trying footing in language. working faceapi , have working beautifully. during recognize phase have ajax call returns array of info. $.ajax({ url: 'http://api.face.com/faces/recognize.json?&uids=all&namespace=camera_app&detector=aggressive&', data: formdata, cache: false, contenttype: false, processdata: false, datatype:"json", type: 'post', success: function (data) { photo = data.photos[0]; handleresult(photo) }, but interested in "uids" called api matches person's face uid. want know once uid returned can timestamp placed , saved database have setup? [sidenote: users photos submitted api, not save them on database. thing saving users first/last name , uid.] don't know how timestamp function wor...

php - Getting Unexpected xpath results -

here source xml: xml this xml of fxg file produced adobe. fxg document valid xml, , contains information document can edited. specific question pertains text can changed within fxg content can change. i'm tryng grab richtext elements , attributes within element have attribute of s7:elementid using xpath relative location. the source xml has 3 total richtext elements, 2 of them having s7:elementid <?php $url = "http://testvipd7.scene7.com/is/agm/papermusepress/hol_12_f_green?&fmt=fxgraw"; $xml = simplexml_load_file($url); $xml->registerxpathnamespace('default', 'http://ns.adobe.com/fxg/2008'); $xml->registerxpathnamespace('s7', 'http://ns.adobe.com/s7fxg/2008'); $textnode = $xml->xpath("//default:richtext/@s7:elementid"); print("<pre>".print_r($textnode,true)."</pre>"); ?> i got far question. returned array not expecting. setting xpath did, expectin...

Content Type HTTP application/octet-stream is not supported in FireFox with JPlayer in MVC3 -

Image
i'm having issue firefox , jplayer (i think same problem in ie9): whenever try play video in firefox following error in console , video wont play: "content-type" http of "application/octet-stream" not supported. well, translating, means "content-type" http of "app/octet-stream" not supported. load of media resources "name" failed. it works fine in chrome though. have researched, looks firefox has problems mime types , wont load has octet-stream in it. however, havent found way solve this. read must declare mime types in iis config. don't know how make work while debugging. well, problem solved firefox, apparently had supply mv4 type instead of basic mv4, ogv , webmv. new jplayerplaylist({ jplayer: "#jquery_jplayer_2", cssselectorancestor: "#jp_container_2"}, messagevideos , { ...

servlets - What role does the keystore files play for SSL? -

being , new ssl managed application running using https: in tomcat server added <connector port="8443" maxthreads="150" minsparethreads="25" maxsparethreads="75" enablelookups="true" disableuploadtimeout="true" acceptcount="100" debug="0" scheme="https" secure="true" clientauth="false" sslprotocol="tls" keystorefile="c:/keystore.key" keystorepass="mypassword" sslenabled="true" /> and in application added <user-data-constraint> <transport-guarantee>confidential</transport-guarantee> </user-data-constraint> now question if delete keystore file c:\ generated using : keytool -genkey -alias tomcat -keypass pass -keystore keystore.key -storepass pass my application still runs in https ? difference make if have file or not ? couldnt tell ? private key...

Is it possible to limit the dimensions/area of an editable shape in Google maps API v3 so that one cannot be drawn to large or small? -

i want able draw shapes (circles, polygons , rectangles) on google map place limits on size (area) of shape can drawn. taking circle example, desired behaviour user starts dragging mouse point on map form circle , circle hit invisible boundary , stop expanding. i'll define size/area of shape geographical area covers. ideally able stipulate limits on geographical area shape covers. in circle example, specify circle stop expanding when geographical area covers reaches, 10 square kilometres, regardless of viewport zoom level. i haven't though how work drawing polygon i'm sure it's bit more complicated because of fact polygon drawn in stages (multiple clicks)... 1 step @ time. this best solution come circle scenario. note, doesn't explicitly stop circle's resize it's being edited, user releases resize, circle snaps maximum allowed size. may not ideal per chrismarx & zeusakm notes above, there doesn't appear native way google's api...

actionscript 3 - Loading and unloading fonts for multilingual Flex app -

my flex app allows people enter text. there's broad selection of fonts choose from. because multi-lingual app, of fonts (e.g. chinese) large indeed - big embed fonts. i know can load fonts @ runtime via stylesheets - plan people select font (a small wait while font loads not problem). want able unload fonts again, app doesn't consume huge amount of memory if people select 1 font , another. i can't see way it, though. can load fonts @ runtime, not unload them. ideas? i did see this question on mentions loading fonts part of module - 1 font per module, guess. advantage being modules can unloaded. then, font isn't accessible outside module, questioner points out. seems dead end. if it's not possible, - sadly - accept answer shows me it's impossible, more useful alternative strategy! must pretty common scenario people have run before... as intuition suggests, relatively common scenario flex developers - there's got solution! as have su...

java - How to loop addview for table row? -

i've write code add textview table row, i've problem number of rows, i've made number of table rows constant (5 rows) , want number of table rows dynamic. want loop code don't know how. can teach me how that? thank :) here code: tablerow row0 = new tablerow(this); tablerow row1 = new tablerow(this); tablerow row2 = new tablerow(this); tablerow row3 = new tablerow(this); tablerow row4 = new tablerow(this); row0.addview(createtextview(listtipe.get(0).gettype())); row1.addview(createtextview(listtipe.get(1).gettype())); row2.addview(createtextview(listtipe.get(2).gettype())); row3.addview(createtextview(listtipe.get(3).gettype())); row4.addview(createtextview(listtipe.get(4).gettype())); row0.addview(createtextview(listtotal1.get(0).gettotal())); row1.addview(createtextview(listtotal1.get(1).gettotal())); row2.addview(createtextview(listtotal1.get(2).gettotal())); row3.addview(createtextview(listtotal1.get(3)...

apache pig - Too many fetch failures on Hadoop -

i hadoop/pig beginner. i trying build hadoop clsuter. 1 data node , master node acting data node. have followed instructions given in : http://www.michael-noll.com/tutorials/running-hadoop-on-ubuntu-linux-multi-node-cluster/ when try run sample hadoop examples. getting "too many fetch failures". i have names of master , host configured in /etc/hosts of both master , slave. have changed somaxconn value 1024. what missing here? please help. this known issue. check hdfs bug database status of bug , fix. work around use / replace jetty.jar latest or higher version > 1.26 other option increase fetch attempts, in mapred-site.xml

android-query, downloading images for a listView -

i'm using android query download image in each element of listview, , downloading thoses images very, very, slow (images far heavy). i'm having image appearing each 5 minutes or so.. first i'm surprise we've got instanciate 1 object aquery each convertview, suppose lib doesn't queu threads way.. if knows better lib, intrested i don't know i'm doing wrong , hope ! here code of adapter : private class mainpagerlistviewadapter extends baseadapter { private arraylist<event> datalist; private layoutinflater inflater; private context context; public mainpagerlistviewadapter(context context, arraylist<event> datalist) { this.inflater = layoutinflater.from(context); this.datalist = datalist; collections.sort(datalist, new alaunesort()); this.context = context; } @override public int getcount() { return datalist.size() + 1; } @override public object...

php - cURL cookiejar line commented out with #HttpOnly_? -

i'm trying login punbb forum different page on same domain using curl. when logging in, curl gets executed , initial response 'successful login' page of forum. no cookie got set when clicking link in forum, , i'm logged out. after bit of investigating cookiejar file mentions cookie needed login. if create cookie , value manually inb browser, logged in , well. cookie value stored correct. the line containing cookie name/value in cookiejar commented out. first question: why? second: how prevent behavior? here's cookiejar: # netscape http cookie file # http://curl.haxx.se/rfc/cookie_spec.html # file generated libcurl! edit @ own risk. www.example.com false / false 0 phpsessid 3d7oe6vt3blv3vs3ea94nljcs7 #httponly_www.example.com false / false 1340974408 forum_cookie_e19209 mnwyywq4ogvindi2nje5mwewmgzingzkndfmzdy5zdzhyjm5ota5ndvjfdeznda5nzq0mdh8otu0ntexogzhnwnlngy5ogmzzdk3mme0ndlmmwrjnzm3zji1nzmxoa%3d%3d and here's curl call: f...

php - Access files in other domain -

very easy, have: domain1.com domain2.com set on cpanel/whm dedicated server i want access image domain1.com domain2.com without using full http route instead of this <img src="http://www.domain1.com/files/image1.jpg" /> i want this: <img src="../../domain1/public_html/files/image1.jpg" /> how do this? it can done... if both domains on same server. on linux/bsd (or *nix) server set create symbolic link in domain2 www directory actual directory in domain1. if use apache, might able redirect requests transparently using .htaccess. bit more difficult , may not work on apache installations. with both these solutions you'll end url's make domain1 subdirectory of domain2. example: <img src="/domain1/files/image1.jpg" />

user defined functions - Segment violation issue with UDF (C code) writtern for CFD solver Fluent -

user defined function (udfs) functions 1 can program , can dynamically loaded along cfd software fluent solver enhance standard features. udfs written in c programming language. following section of udf: /*memory allocation @ first call subroutine*/ if(cellaroundnodefirstcallflag==0) { cellaroundnodefirstcallflag=1; avg_cellaroundnode =(cell_t**)calloc((nnum+1),sizeof(cell_t)); for(i=0;i<nnum;i++) { avg_cellaroundnode[i] =(cell_t*)calloc((ncellanode+1),sizeof(cell_t)); } } if (avg_cellaroundnode!=null) { message("check: not null.... \n"); } message("check enter... \n."); message("check:array size %d %d \n",nnum,ncellanode); /*initializing matrix*/ for(i=0;i<nnum;i++) { for(j=0;j<ncellanode;j++) { message("check:initalizing cell: %d %d \n",i,j); avg_cellaroundnode[i][j]=-1; } } message("check exit...."); i have no ...

c# - Caching Entities causes unwanted inserts -

if cache entire table: static list<table1> table1cache = context.table1.tolist(); then use associate: var context = new context(); var t2 = new table2(); t2.mytable1reference = table1cache.single(x=>x.id == paramintid); context.savechanges(); a new row inserted table1, because of third line. ef thinks new entity. know can somethings attaching cache when create de context(i have 1 context per request), or use mytable1referenceid = table1cache.single(x=>x.id == paramintid).id; but not secure, can forget sometimes, there solution? yes, makes sense because entity not associated current context. therefore ef thinks it's transient , saves new instance. if caching across contexts, don't want store object itself. related context. instead want store data in cache. serializing , deserializing entity. need associate entity when current context next time it's retrieved cache can save change both cache , database. if sounds lot, is. keeping 2 data ...

php - Insert values in an associative array but only if have value -

i've bucle: foreach($jsonu $j) { $jsonuid = $j->id; $jsonuname = $j->name; $jsonudescription = $j->description; $jsonudate = $j->date; $jsonustatus = $j->status; $jsonupicture = $j->picture; $jsonuncompleted[] = array('id'=> $jsonuid, 'name'=> $jsonuname, 'description' => $jsonudescription, 'date' => $jsonudate, 'status' => $jsonustatus, 'picture' =>$jsonupicture); } i need insert key in array if have value. example, $jsonupictore not has value , in case don't need write key. some help? you use array_filter function or without parameter: http://www.php.net/manual/en/function.array-filter.php example: $jsonuncompleted[] = array_filter( array( 'id'=> $jsonuid, 'name'=> $jsonuname, 'description' => $jsonudescription, 'date' => $jsonudate, 'status' => $json...

java - How to cause table cells to use all screen height in TableLayout? -

Image
i new android development. have activity in set few buttons in 2 table rows. use small portion of here xml layout activity: <?xml version="1.0" encoding="utf-8"?> <tablelayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/tablelayout1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <tablerow android:id="@+id/tablerow1" android:layout_width="wrap_content" android:layout_height="wrap_content" > <button android:id="@+id/button1" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="button" /> <button android:id="@+id/button2" ...

delphi - How to keep uses list of several projects identical -

i have client application , test application. if adds/removes units client application, same changes happen test application. i can think of 3 ways it, have drawbacks 1. manually update test project uses list in dpr. the problem here obvious, requires manual intervention per project. 2. use shared .inc file contains list of used units (list of frmxxx in '\forms\frmxxx.pas'...) ide doesn't .inc files in project file , again require manual work maintain 3. same #2, use shared unit instead of .inc file. instead of updating .inc update shared .pas ide not consider files used shared unit files in project , wouldn't listed in view unit dialog are there other ways keep uses lists of multiple projects in sync i'm missing ? currently using d2007 doesn't matter. you use build tool apache ant, maintain unit names in script file (or configuration file), , let ant replace placeholder in *.dpr files using replace task . this regenerate dpr f...

java - In a Spring MVC Hibernate application when using properties file throwing error? -

in spring mvc hibernate application , when trying use properties file ,which under src/java/resources , throwing below error : org.springframework.beans.factory.beancreationexception: error creating bean name 'usercontroller': injection of autowired dependencies failed; nested exception org.springframework.beans.factory.beancreationexception: not autowire field: private java.lang.string com.mcb.controller.usercontroller.strdefaultpage; nested exception java.lang.illegalargumentexception: not resolve placeholder 'mcbpage.name' i using below code access property value in controller class: @value("${mcbpage.name}") private string strdefaultpage; i added bean in applicationcontext.xml file property file: <bean id="mcbproperties" class="org.springframework.beans.factory.config.propertiesfactorybean"> <property name="ignoreresourcenotfound" value="true" /> <property name="locati...

.net - Linq to SQL with UDF - paging exception -

good day. got table result udf in ms sql 2008r2 base , mapped class "applicationgroupsresult" alter function [dbo].[netsqlazman_applicationgroups] () returns table return select dbo.[netsqlazman_applicationgroupstable].* dbo.[netsqlazman_applicationgroupstable] inner join dbo.[netsqlazman_applications]() applications on dbo.[netsqlazman_applicationgroupstable].applicationid = applications.applicationid [function(name="dbo.netsqlazman_applicationgroups", iscomposable=true)] public iqueryable<applicationgroupsresult> applicationgroups() { return base.createmethodcallquery<applicationgroupsresult>(this, (methodinfo) methodbase.getcurrentmethod(), new object[0]); } now want take few records: var query = context.applicationgroups(); totalrecordscount = query.count(); query = string.isnullorwhitespace(sortby) ? query.orderby(x => x.applicationgroupi...

html - automatic login to website only works when session is made -

i'm making offline webpage automatically logs online website. website uses ssl ( https ) , login uses form (post variables) the problem i'm encountering following: site accepts offline form, when open online login page first. because website uses (server-side) sessions made when opening first page. (the purpose of session detect time-out) when first open online website , run offline page works fine. so need make offline webpage open online website before posting form automatically. i tryed iframe , doesn't work in internet explorer, https website. (it work in chrome, firefox,...) i wondering if ajax send https page request before posting form. guess not https. does know method send https page request browser does, without showing it's output? afterward can automatically submit form. thanks in advance! internet explorer treats iframes other domains third party content, , uses separate set of security policies them. security zone settings in ...

android - how to multiple contents of a table from database in listview and in table format -

i have 2 tables in database, 1 contains userid , password , stuff, , other 1 contains transactions. when user login in app should able display transaction in table format. i wondering how use list view in table format, , display transactions @ once. table users(id integer primary key,username text,password text,fullname text,age integer); table userdetails(cid references useres(id),withdraw int,deposit int,balance int); when user login want display transactions in listview , clear list when logout, should do?

Check Value from mysql using android -

i have table has field called sold , in field store 0 , 1. 1 means sold , 0 mean available. k, problem ,i want change 0 available , 1 sold when diplay information emulator , here tried returning sold though have 0 in database : if (sold.length()==0){ log.d("checking","inside = 0"); val = "available";} else if (sold.length()>0) log.d("checking","inside = 1"); val = "sold and sold contains value database. please change 0 available , 1 sold. if(sold.equalignorecase("0")) { log.d("checking","inside = 0"); }else { log.d("checking","inside = 1"); }

javascript - Webgl Angle loops really slow -

i have here glsl, , works charm. compiling taking 3 minutes or something. know due angle, angle piece of software converts opengl es 2.0 code directx 9 webgl on windows systems. if disable angle, compiles in second. know's why nested loops soo slow in angle. , if there work around? mean can't let wait more minute per shader. for ( int b = 0; b < numberofsplitpoints; b++ ) { if ( cameradepth > splitpoints[b] && cameradepth < splitpoints[b+1] ) { const float numberofsplitpoints = float( number_of_split_points - 1 ); vec4 projcoords = v_projtexturecoords[b]; projcoords /= projcoords.w; projcoords = 0.5 * projcoords + 0.5; float shadowdepth = projcoords.z; projcoords.x /= numberofsplitpoints; projcoords.x += float(b) / numberofsplitpoints; for( int x = 0; x < fullkernelsize; x++ ) { for( int y = 0; y < fullkernelsize; y++ ) { vec2 pointer = vec2( float(x...

java - Why am I getting an ArrayIndexOutOfBoundsException in my code? -

why getting java.lang.arrayindexoutofboundsexception :0 @ copyfile.main //copy 1 file data file import java.io.*; class copyfile{ public static void main(string[] args)throws ioexception{ fileinputstream fis=new fileinputstream(args[0]);//reading file fileoutputstream fos=new fileoutputstream(args[1]);//reading file int data; while((data=fis.read())!=-1){ fos.write(data); /*here using while loop copy data 1 file , storing in file*/ } } } it seems running file as java copyfile if so, wrong. should pass arguments run code since looking 2 arguments. run code way:- java copyfile arg1 arg2

orchardcms - Rules - Sending out Email with the custom form fields values -

i using orchard 1.4.2. had installed custom form module..created custom form has enumeration fields , input fields. now, want create rule send out emil when form submitted. form should have values inserted/selected user. i can input fields value using request.form:testform.firstname.value , can't seem enumeration field ( drop down) selected value. tried various options, nothing works. any ideas? in 1.5, can content.fields.testform.firstname.value. in 1.4.2, may not have access field properties way. in meantime, have write own token.

Cannot install py2exe with Python 2.7 -

i trying install py2exe . have python 2.7 installed on machine. website mentions have released support 2.7, when try install, mentions python version 2.6 required, not found in registry. have downloaded py2exe-0.6.9. any 1 else come problem , figured out how solve it? try this link . it's py2exe python 2.7.

c# - Get ViewModel data using MEFedMVVM -

i using mefedmvvm framework access viewmodels , want know how data viewmodel being used. coupled use of cinch. at present tab control defined below: <window.resources> <datatemplate datatype="{x:type cinchv2:workspacedata}"> <adornerdecorator> <border horizontalalignment="stretch" verticalalignment="stretch" cinchv2:navprops.viewcreator="{binding}"/> </adornerdecorator> </datatemplate> </window.resources> and main window viewmodel setup in following way once view has been loaded: private void viewawarestatusservice_viewloaded() { if (designer.isindesignmode) return; //string imagepath = configurationmanager.appsettings["yourimagepath"].tostring(); workspacedata loginworkspace = new workspacedata(null, "loginusercontrol", null, "login", true); ...