Posts

Showing posts from August, 2010

javascript - Check a Boolean value from database at the start of an app then load terms and condition page if false, load menu page if true -

is possible? before page loads, run javascript code check value in database is, open relevant page? here code far: function ondeviceready() //phone gap ready { try { db = opendatabase('cuopioid', '1.0', 'cupioids application database', 2 * 1024 * 1024); } catch (e) { // error handling code goes here. if (e == invalid_state_err) { // version number mismatch. alert("invalid database version."); } else { alert("unknown error " + e + "."); } } console.log("database created!"); db.transaction(createtableterms, errcb, console.log("medicines table created!")); $('#btnaccept').on('click', acceptterms); } the code below creates database (if isn't there already) function createtableterms(tx) { tx.executesql('create table if not

android - how to display current progress on progress bar when activity comes to foreground -

i using progress bar displaying status of data download server using asynktask. i have written callback method update progress @override public void onbookdownloadprogressupdated(int value) { if(_bookprogressbar == null) { linearlayout linearlayout = (linearlayout) latestlinearlayout.findviewwithtag(layouttagqueue.peek()); _bookprogressbar = (progressbar) linearlayout.getchildat(1); } _bookprogressbar.setprogress(value); } this works fine.but when user goes screen , coming screen progress bar didn't show progress while downloading going on in background. how show current progress user press key , revisit screen. try using below link progress bar , put method set value of progress bar in onresume() instead of oncreate() or onstart(). use static variable(int) showing progress of progressbar. download file android, , showing progress in progressdialog

c# - Access Elements in DataTemplate -

i have following item template (i tried strip non relevant stuff): <s:surfacewindow.resources> <resourcedictionary> <style targettype="{x:type s:surfacelistbox}"> <setter property="itemtemplate"> <datatemplate datatype="{x:type local:myclass}"> //my own class <s:surfacebutton> <textblock text="{binding name}"> //name string in own class //and close tags the idea listbox contain buttons displaying words on it. further down, have surfacelistbox using above resource. add in item by: mylistbox.items.add(new myclass("my name")); and add button listbox nicely, button displaying "my name". now need change "my name" string. how access textblock ? i have tried googling solutions access items in datatemplate require visualtreehelper.getchildrencount via findvisualchild , re

javascript - add content to model on createRecord() -

i got ember model looks this: app.collection = ds.model.extend({ types: ds.hasmany('app.type') }); it's obligated have 4 types in collection. i want make sure everytime createrecord() get's called, model creates 4 new types well. how can this? thanx!

cryptography - How to encode and decode SecretKey in JAVA? -

keystore ks = keystore.getinstance("jceks"); ks.load(null, null); secretkey skinput = new secretkeyspec("input".getbytes(), "desede"); secretkeyentry skeinput = new keystore.secretkeyentry(skinput); ks.setentry("input_key", skeinput, new keystore.passwordprotection("banana".tochararray())); fileoutputstream fos = new fileoutputstream("my.keystore"); pambks.store(fos, "password".tochararray()); fos.flush(); fos.close(); the code shown above trying encode input secretkey , store keystore. code shown below how retrieve key keystore. not know how decode original value? fileinputstream fin = new fileinputstream("my.keystore"); keystore ks = keystore.getinstance("jceks"); ks.load(fin, "password".tochararray()); secretkeyentry ske = (secretkeyentry) readks.getentry("input_key", new keystore.passwordprotection("banana".tochararray())); secretkey sk = ske.getsecretkey

sql - How to increment column regard on another column value -

i have following data: (1,'20120615 8:03:43 pm'), (1,'20120615 8:03:43 pm'), (1,'20120615 8:03:48 pm'), (1,'20120615 8:03:53 pm'), (0,'20120615 8:03:58 pm'), (1,'20120615 8:04:03 pm'), (1,'20120615 8:04:08 pm'), (1,'20120615 8:04:13 pm'), (1,'20120615 8:04:18 pm'), (0,'20120615 8:04:23 pm'), (1,'20120615 8:04:28 pm'), (1,'20120615 8:04:33 pm'); my desired result is: (1,'20120615 8:03:43 pm', 1), (1,'20120615 8:03:43 pm', 1), (1,'20120615 8:03:48 pm', 1), (1,'20120615 8:03:53 pm', 1), (0,'20120615 8:03:58 pm', 0), (1,'20120615 8:04:03 pm', 2), (1,'20120615 8:04:08 pm', 2), (1,'20120615 8:04:13 pm', 2), (1,'20120615 8:04:18 pm', 2), (0,'20120615 8:04:23 pm', 0), (1,'20120615 8:04:28 pm', 3), (1,'20120615 8:04:33 pm', 3); in words want group data except 0 above order. here idea.

java - "One App" Android System -

i created android app communicates via usart µc in order evaluate data. co-workers , customers should use tablet purpose now. there possibility "hide" android os or making inaccessible? devices rooted , willing build custom roms (even though not have experience yet). there approaches available not have start scratch? many help. well. i'm trying ! the first thing tried start app after boot of device (quite easy with this ). then, android source code, , hide bottom bar using this code the problem is, if application not stable ... you'll have problem. if want modify android source code, the developper doc contains tutorial start !

PHP SoapClient: How to prefix SOAP parameter tag name with namespace? -

i'm using php's soapclient consume soap service receiving error soap service cannot see parameters. <tns:genericsearchresponse xmlns:tns="http://.../1.0"> <tns:status> <tns:statuscode>1</tns:statuscode> <tns:statusmessage>invalid calling system</tns:statusmessage> </tns:status> </tns:genericsearchresponse> the xml php's soapclient sends soap call: <soap-env:envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://.../1.0"> <soap-env:body> <ns1:genericsearchrequest> <uniqueidentifier>12345678</uniqueidentifier> <callingsystem>web</callingsystem> </ns1:genericsearchrequest> </soap-env:body> </soap-env:envelope> i used soap-ui initially, works when consuming same wsdl. xml soap-ui sends call: <soap-env:envelope xmlns:soap-env="http://schemas.xmlsoap.

c# - Display Modal Popup On Button Click -

i want show modal popup after click save button save values in db , while showing modal popup, should continue saving, without closing modal popup using code protected void btsave_click(object sender, eventargs e) { modalpopupextender1.show(); //my code } and aspx code <input type="button" runat="server" id="btmodel" style="display: none" /> <ajaxtoolkit:modalpopupextender id="modalpopupextender1" runat="server" targetcontrolid="btmodel" popupcontrolid="panel1" popupdraghandlecontrolid="popupheader" drag="true" dropshadow="true" okcontrolid="okbutton" cancelcontrolid="cancelbutton" backgroundcssclass="modalpopupbg"> </ajaxtoolkit:modalpopupextender> <asp:panel id="panel1" style="display: none" runat="server"> <div class="pr

the attribute send by jsp is nowhere in servlet -

i trying parameter monitorscreen in servlet following url. get /random/servlet/ps.commands.getcmd?monitorscreen=true http/1.1 but when variable or value monitorscreen in particular servlet not able find anywhere in servlet this way retrieve parameters in servlet following url, www.someserver.com/somepage.jsp?monitorscreen=true then in doget method of servlet, string value = request.getparameter("monitorscreen");

testing - JUnit - Rerun Tests in same order through Eclipse -

i able re-run group of unit tests in same order run. yes, understand running test in random order better in general, because uncover bugs may covered in 1 particular test ordering. however, once find bug based on test order extremely useful re-run tests in same order on , on can debug. there anyway through eclipse/junit? junit not guarantee order running mentioned yourself. can build dependencies when write test function calls other test-methods methods should not annotated. run tests in same order, couldn't test them seperately. another approach use testframeworks enables dependancy-management. therefore have @ testng (another java test-framework) or jexample (builds on junit visit http://www.iam.unibe.ch/~akuhn/blog/2008/jexample-quickstart/ short introduction)

when javascript function alter html input text ,I want the input text trigger a event like calling other JS function -

i try use onchange work when alter text focusing mouse cursor on , when alter text using function not anything <input type="button" value="testbutton" onclick="altertext()" /> <br /> <input id="txtbox1" type="text" onchange="alertme()" /> <script> var counter = 0; function altertext(){ counter=counter +1; document.getelementbyid('txtbox1').value = counter; } function alertme(){ alert("done!.."); } </script> you can call yourself. var counter = 0; function altertext(){ counter=counter +1; document.getelementbyid('txtbox1').value = counter; alertme.call(document.getelementbyid('txtbox1')); } function alertme(){ alert("done!.."); }

javascript - Images not being transformed to correct dimensions in image carousel -

when adding anchor tag around images in image carousel (using " caroufredsel " 6.2 jquery library), images not correctly transformed correct dimensions. when removing anchor tag, images transformed correct dimensions , work expected. css has been changed styling applied image applied anchor tag instead , problem still not resolved. to demonstrate problem, have reproduced problem on jsfiddle along expected result in fiddle. actual javascript code used starts @ line 19. actual result expected result it worth noting have changed snippet: #carousel img { display: block; float: left; border: none; position: relative; } to #carousel { display: block; float: left; border: none; position: relative; } to apply styling anchor tag instead of image, reflected in code on jsfiddle. you problem in js applying css on instead of img. partially resolved, unfortunately dont have enough time right can start here add .children() img intead of a

.net - How to debug standalone code in asp.net web application (equivalent to a java main() method) -

i'm java developer. need write components in .net. i've created asp.net web application (my component needs service called in http). question 1 created httphandler, calls class smething usual (lets say, iterate on list). i want debug method in other class, using main method, (as would've done in java/eclipse), way visual studio 2010 lets me debug code http service. any way debug simple standalone code inside web application? thanks.

Create operator / function for custom type in PostgreSQL 9.2 -

i have following custom type: create type param_range ( param smallint, range int4range ); the following table: create table test4 ( id serial not null, geo point, ext param_range[] ) the following indexes: create index ix_test4_geo on test4 using gist ((geo)); create index ix_test4_ext on test4 using gin (ext); the gin index requires operator / function custom type. how do this? the gin index doesn't require custom operator. requires whole family of operators. need to: consult documentation regarding gin opclasses. write set of immutable functions handle those. write set of operators based on functions. tie in custom operator class. this isn't simple, small amount of work. requires fair bit of though (what "overlap" mean in context of type?" , need expect spend fair bit of time in design phase. basically if want gist/gin support designing custom type not storage operational purposes. project.

script client code to php webservice -

i sticky on problem : here php server side code , wanna web service , client java script , wrote in php client , worked ,, tried many times make client java script call web service php server according yii framework , can body give me java script code handle web service in php code down (ther 1 service getsms) , , if body wanna script code check error , send him: ** <?php ini_set ('soap.wsdl_cache_enabled',0); class webservicescontroller extends controller { /** * @var string default layout views. defaults '//layouts/column2', meaning * using two-column layout. see 'protected/views/layouts/column2.php'. */ /** * @return array action filters */ /** * specifies access control rules. * method used 'accesscontrol' filter. * @return array access control rules */ public function accessrules() { return array('allow', 'actions'=>array('quote'),

django: getattr function (get field name) -

i can't make function getattr work. here code: print configconsmodel()._meta.get_all_field_names() #['codesectrepmodel', 'configcons', 'id'] modelinstance=configconsmodel() newattrname1=getattr(modelinstance, "configcons") print newattrname1 #empty -> pb what's wrong? modelinstance=configconsmodel() this initializes modelinstance new (empty) instance of configconsmodel class newattrname1=getattr(modelinstance, "configcons") this line equivalent to newattrname1=modelinstance.configcons it not attribute's name, gets it's value. of course empty.

c# - listview FindItemWithText empty or not? -

i'm searching listview item specified string. if string found select listviewitem. listviewitem index = listview1.finditemwithtext(txtsearch.text); pretty simple :) i'm having hard time figure, want know index variable populated, thinking check length property cannot find, once again how know index variable empty or not? thanks finditemwithtext method returns null if list empty or there no matching item. so, check result null: listviewitem item = listview1.finditemwithtext(txtsearch.text); if (item != null) { // have match }

list - Python and Yaml files inserting objects -

it's possible add data python command yaml file? here's yaml file: !obj:pylearn2.train.train { dataset: !obj:pylearn2.datasets.hepatitis.hepatitis &dataset { }, model: !obj:pylearn2.models.mlp.mlp { batch_size: 50, layers : [ # use 2 hidden layers maxout activations !obj:pylearn2.models.maxout.maxout { layer_name: 'h0', num_units: 300, num_pieces: 2, irange: 0.5, }, #i want add of !obj:pylearn2.models.maxout.maxout{...} python file... !obj:pylearn2.models.mlp.softmax { layer_name: 'y', # initialize weights 0s irange: 0.5, n_classes: 2 } ], nvis: 2612, }, algorithm: !obj:pylearn2.training_algorithms.sgd.sgd { learning_rate : 1e-3, batch_size : 50, monitoring_batches : 20,

How to set-up this Python data structure in R -

i have following data structure in python set-up in r. correct way achieve that's akin python set-up. testing = [ [[12,14], [4]], [[2,1], [5]], [[42,11], [13]] ] edit 1 based on proposed solution agstudy using following code library(rjson) json_file <- "/path/jsondata.json" json_data <- fromjson(paste(readlines(json_file), collapse="")) things worked great. produced following: list(list(c(12, 14), 4), list(c(2, 1), 5), list(c(42, 11), 13)) what this? nested list type structure? ll <- list( c( list(c(12,14)),4) , c(list(c(2,1)),5),c(list(c(42,11)),13)) str( ll ) list of 3 $ :list of 2 ..$ : num [1:2] 12 14 ..$ : num 4 $ :list of 2 ..$ : num [1:2] 2 1 ..$ : num 5 $ :list of 2 ..$ : num [1:2] 42 11 ..$ : num 13 access elements through [[ method: # second list element of first top-level list element ll[[1]][[2]] #[1] 4 # first list element of third top-level list element ll[[3]

swing - Java JPanel expand one panel in BorderLayout -

i have 2 simple jpanels, 1 positioned on top , other on bottom. now im trying resize top panel take more space (and therefore push bottom panel down) ive added button listen on call like: button.addmouselistener(new mouseadapter() { public void mousereleased(mouseevent e) { paneltop.setsize(10, 200); } }); this how add panels: add(paneltop, borderlayout.north); add(panelbottom, borderlayout.south); any ideas if possible? my tests not working @ all you should use setpreferredsize instead of setsize . borderlayout notice , resize panel on next validate() .

java - Using JFileChooser with LWJGL -

i trying use jfilechooser lwjgl filechooser.isdisplayable() returns false, checked because wouldn't pop up. this using, private void choosefile(){ choose = new jfilechooser(); choose.setcurrentdirectory(new file(".")); choose.setfileselectionmode(jfilechooser.files_and_directories); choose.setfilefilter(new filefilter(){ @override public boolean accept(file f) { if(f.isdirectory()){ return true; } final string name = f.getname(); return name.endswith(".png"); } @override public string getdescription() { return "*.png"; } }); } so if has experience or knows why shouldn't couldn't or never work or ever tell me, can go on life , find other solution, or fix if knows how to. you never tell jfilechooser open dialog. need call filechooser.showopendialog() or 1 of other dialog methods

javascript - jQuery "on" blur event -

i have following code in app; inputfld.on("blur.typeahd", function(){alert(1)}); now there inputfld dom element on page but not see element class of "typeahd" still code goes inside function , alert 1 my question if interpreting blur.typeahd incorrectly? typeahd element in case or else? yes, getting wrong. here blur.typeahd stands event namespace

java - Email is sending but not receiving when use no authentication -

i sending email using public void sendemail(string fromemailaddr, string toemailaddr,string subject, string emailbody) { string host = "xxx"; final string user = "user"; final string password = "password"; // system properties properties properties = new properties(); // setup mail server properties.put("mail.smtp.host", host); properties.put("mail.smtp.port", "25"); // default session object. session session = session.getdefaultinstance(properties, null); try{ // create default mimemessage object. mimemessage message = new mimemessage(session); // set from: header field of header. message.setfrom(new internetaddress(fromemailaddr)); // set to: header field of header. message.addrecipient(message.recipienttype.to, new internetaddress(toemailaddr)); // set subject: header field message.set

sql - ComboBox not showing DisplayMember -

i'm trying display question id's in combo box, in order reproduce matching question in text box. rather question id's appearing, receiving 5 question id's: wcinterface.ucquestions+questionwcinterface.ucquestions+question my code: private loaded boolean = false private sub ucquestions_load(byval sender system.object, byval e system.eventargs) handles mybase.load cmbquestion.displaymember = "question_id" cmbquestion.valuemember = "question_id" cmbquestion.datasource = retrievequestions() 'when form loads loaded = true end sub private sub cmbquestion_selectedindexchanged(byval sender system.object, byval e system.eventargs) handles cmbquestion.selectedindexchanged if (loaded) cmbquestion.displaymember = "question_id" cmbquestion.valuemember = "question_id" cmbquestion.datasource = nothing 'resets data source cmbquestion.datasource = retrievequestions() &#

android - Can't seek mp3 more than 50% with MediaPlayer in AsyncTask -

seeking not work correctly in code, can seek in first half of files, tested mp3 in {30min, 60min, 90min, 120min} , don't work, mp4 it's ok. public class player extends asynctask<integer, integer, integer> implements onbufferingupdatelistener, oncompletionlistener, onerrorlistener { private static mediaplayer mp; protected static player player = null; public player(){ mp = defined.mp; mp.setonbufferingupdatelistener(this); mp.setoncompletionlistener(this); mp.setonerrorlistener(this); } doinbackground: @override protected integer doinbackground(integer... params) { preparefiletoplay(); mp.start(); startprogress(); return null; } prepare file: protected void preparefiletoplay(){ string url="http://192.168.1.2/test10.mp3"; //mp3 duration: 60min mp.reset(); try { mp.setdatasource(url); mp.prepare(); publishprogress(playing); } ca

gdb - Manually generate elf core dump -

i looking manually generating elf core dump file. i have ram dump program, , can retrieve register informations , on. with data, build elf core dump file, similar generated linux kernel when program crashes, goal analyse core dump gdb made platform. i have been looking core dumps specifications or detailed format, did not find wanted : what sections core dump file require ? how organized elf container ? how go having binary ram dump (+ registers values) core dump file. this must preferably done in c, thought use libelf library me build file, did not found relevant information put in file, , in format, clue, link or advice welcomed. note : not raising exceptions , have job done kernel me, can that, need gather myself ram , register data manually elf core dump. thanks ! i looking manually generating elf core dump file. just use google elf userspace coredumper , exactly that. i want build core dump, not implement directly software there no ex

php - Where does move_uploaded_file store the file? -

i trying upload file through web form. script outputs following, , there no errors. still can not find directory on server. specifying location wrong? tried /upload , full path see in ftp client: /cygdrive/i/home/antor/dance/upload upload: 1.jpg type: image/jpeg size: 107.9072265625 kb stored in: c:\windows\temp\php767.tmpupload: 1.jpg type: image/jpeg size: 107.9072265625 kb temp file: c:\windows\temp\php767.tmpstored in: upload/1.jpgupload: 1.jpg type: image/jpeg size: 107.9072265625 kb temp file: c:\windows\temp\php767.tmp stored in: /cygdrive/i/home/antor/dance/upload/1.jpg this code used: <form action="upload_file.php" method="post" enctype="multipart/form-data"> <label for="file">filename:</label> <input type="file" name="file" id="file"><br> <input type="submit" name="submit" value=&qu

matlab - changing the size of stencil during iterations within a for loop -

i have matrix [35rows x 39columns] of 2x1 column vectors, representing ordered pairs. have function creates 9 point stencil , evaluates points, returns 9 values , picks largest one. creates 9 point stencil centered largest return value located, , continues until function terminates @ global maximum value in matrix. my question is, how can make stencil more efficient disregarding points has evaluated? don't want evaluate 9 points every time because take longer, , trying make process fast possible. process: 1.) evaluate point , 8 surrounding it, 2.) pick largest of return values, 3.) move point, 4.) repeat i referencing cell, use {i,j} indexing. here's have code: for k = 1:10^(6) setpoint1 = field{i,j}(1); setpoint1 = field{i,j}(2); setpoint2 = field{i-1,j-1}(1); setpoint2 = field{i-1,j-1}(2); setpoint3 = field{i-1,j}(1); setpoint3 = field{i-1,j}(2); setpoint4 = field{i-1,j+1}(

java - I am trying to short Employee according to firstname but I am getting this error? -

i getting error exception in thread "main" java.lang.classcastexception : com.genous.employee cannot cast java.lang.comparable at java.util.arrays.mergesort(arrays.java:1157) at java.util.arrays.sort(arrays.java:1092) at java.util.collections.sort(collections.java:134) at com.genious.employee.main(employee.java:54)// public class employee implements comparator { string firstname; string lastname; int mobileno; public employee(string firstname,string lastname,int mobileno) { this.firstname=firstname; this.lastname=lastname; this.mobileno=mobileno; } @override public string tostring() { return firstname; } @override public int compare(object o1, object o2) { employee e2=(employee)o1; employee e3=(employee)o2; int i=e2.firstname.compareto(e3.firstname); if(i!=0) return i; return i; } /** * @param args */ public static void main(string[] args) { arraylist list=new arraylist(); employee e=new employee("anand","pandey",9345

php - creating image gallery with Twitter Bootstrap -

i trying create simple , basic image gallery using twitter bootstrap responsive design. the images rendered dynamically. first row of images adjusting second row alignment varies. here code <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>gallery</title> <link href="<?=base_url()?>assets/css/bootstrap.css" rel="stylesheet"> <link href="<?=base_url()?>assets/css/bootstrap-responsive.css" rel="stylesheet"> <style> </style> </head> <body> <div class="container-fluid"> <div class="row-fluid"> <div class = "span12"> <?php for($i=0; $i<10 ;$i++) { ?> <div class = "span3"> <a href="#" class=&q

PHP Post Data overwrites previous text -

this code using post data txt file on server. got question on stackoverflow: file_put_contents('test.txt', file_get_contents('php://input')); the code overwrites previous text in test.txt everytime. how can make insert? know if use fopen, can make insert adding a+ $file=fopen(date("y-m-d").".txt","a+") where should add a+ in file_put_contents? file_put_contents() supports optional third parameter: $flags . pass flag file_append file_put_contents() make append file rather overwriting it: file_put_contents('test.txt', file_get_contents('php://input'), file_append);

php - unable to send mail to multiple person in phpmailer -

i trying send mail multiple users using phpmailer . what doing that: a) firstly entering email ids seperated comma, let user enters : test@test.com,test1@test.com b) explode them array: $email_list = $_post['emailid']; $email_array = explode(',',$email_list); c) array of email array('0'=>'test@test.com','1'=>'test1@test.com') d) sending mail using phpmailer using foreach loop follow : foreach($email_array $email_array ) { $email = $email_array; //die; include('notification/class.phpmailer.php'); $subject = $_post['subject']; $body = $_post['content']; $smtphost = get_option('smtphostlord'); $smtpportlord = get_option('smtpportlord'); $smtpemailord = get_option('smtpemailord'); $smtppasslord = get_option('smtppasslord');

android - scrollview inside viewpager not scrolling -

i have small vertical scrollview inside viewpager horizontal swippable pages. problem not able scroll through pages swiping horizontally on scrollview. want able swipe horizontally on scrollview scroll through viewpager's pages , have function swipe vertically scroll through scrollview's contents. i don´t know if it's same case, had similar problem have described. have looked everywhere find answer: https://stackoverflow.com/a/35180360/1969966 . basically, if activity structure above example: <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.coordinatorlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.design.widget.appbarlayout

testing - Optimizing ruby code for parsing a string to a numeric value -

i working on speed-tests ruby , need parse textfiles numeric values. due slow speed wondering if code optimized, or if ruby slow. code being read files, these files contain around 1 000 000 randomly generated lines or numbers, display few lines, know being read. filenames need read being passed arguments, coed separate scripts (just own clarity). first want parse simple number, input comes in format: type number type number ... this how did it: incr = 1 file.open(argv[0], "r").each_line |line| incr += 1 if incr % 3 == 0 line.to_i end end second need parse single list, input comes in format: type (1,2,3,...) type (1,2,3,...) ... this how did it incr = 1 file.open(argv[0], "r").each_line |line| incr += 1 if incr % 3 == 0 line.gsub("(","").gsub(")","").split(",").map{ |s| s.to_i} end end finally need parse list of lists, input comes in format: type ((1,2,3,...),(1,2,3,

javascript - How to list images from a directory in a div -

my problem this: want pick images diretory, independently of number of them, , list in div through ul/li. have tried below, not showing neither directory name, , directory has 5 pictures. have code in homecontroller : public actionresult contactus() { return view(); } public actionresult listimagesproducts() { directoryinfo diretorio = new directoryinfo(@"~\content\images\products\"); fileinfo[] arquivos = diretorio.getfiles("*.*"); list<string> model = new list<string>(); foreach (fileinfo fileinfo in arquivos) { model.add(fileinfo.name); } var diretory = model; return json(diretory, jsonrequestbehavior.allowget); } and in contactus view, have code: @{ viewbag.title = "three jay - produtos"; layout = "~/views/shared/_layout.cshtml"; } <script src="../../scripts/jquery-1.5.1.js" type="text/javascript"><

android - How to prevent user locking screen while application is still running? -

first of all, know , tested, android os basicly pauses activity when user clicks home button, , resumes activity when user comes back. when user locks screen, destroys activity , recreates when user unlock. why?! there reasonable explanation attitude? my problem attitude of android os, need prevent user locking screen while application still running. because have splash screen lets user in after getting data user, , finishes itself. on second activity, release user's info ondestroy. if user locks screen on second activity, system calls ondestroy , release user's info. how can prevent happen? i'm not sure can prevent screen locking, check if screen locked in ondestroy ( something this or this ). if is, save data in saveinstancestate bundle , retrieve in oncreate... hope helps

javascript - IE9 ignoring scrolling and overflow attributes -

my page loaded iframe, , need adapt size of iframe using javascript. try following: iframe.style.overflow = 'hidden' iframe.scrolling = 'no' var content = iframe.contentwindow.document.getelementbyid('content') var height = content.offsetheight + 10 iframe.style.height = height + 'px' console.log(content.offsetwidth) var width = content.offsetwidth + 10 iframe.style.width = width + 'px' on firefox works supposed to, ie9 ignores both scrolling , overflow attributes. browser mode set ie9-standards. how rid of scroll in iframe under ie9? looks iframe loaded, when you're doing this. can set: iframe.contentwindow.document.body.style.overflow = 'hidden'; if there's literal iframe tag on page, can set scrolling attribute "no" , when setting attribute value js after iframe element has been created page, doesn't work. if you're creating iframe dynamically, can set setattribute('scrolling

c++ - Schedule selector error -

i'm trying port iphone app windows 8, have problem line (it's objective-c) : [self schedule:@selector(fire:)]; the equivalent on c++ should : this->schedule(schedule_selector(airscene::fire)); where airscene name of class, have error returning visual studio 2012 : error c2064: term not evaluate function taking 1 arguments so, in other words function schedule(selector) not found. it's strange because have no problem unschedule method, have idea please ? edit : airscene.h #include "cocos2d.h" #include "box2d\box2d.h" #include "airscenedelegate.h" class airscene : public cocos2d::cclayer { public: airscene::~airscene(void); // here's difference. method 'init' in cocos2d-x returns bool, instead of returning 'id' in cocos2d-iphone virtual bool init(); static cocos2d::ccscene* scene(); layer_node_func(airscene); //methods void selectspritefort

c# - Is there a keyed SHA256 hash algorithm that is FIPS compliant for .NET? -

i creating keyed sha256 hash using hmacsha256 following code: hmacsha256 hmac = new hmacsha256(encoding.utf8.getbytes(secretkey); byte[] hash = hmac.computehash(encoding.utf8.getbytes(data)); string hashresult = string.empty; (int = 0; < hash.length; i++) { hashresult += hash[i].tostring("x2"); // hex format } this working fine, however, fails in fips enabled environment because hmacsha256 uses underlying sha256managed implementation not fips compliant. searching through msdn documentation find sha256 implementation of keyedhashalgorithm hmacsha256. i required sign web service requests keyed sha256 hash (so can't change hash type), , must able run in fips enabled environment. googling shows both sha256cryptoserviceprovider , sha256cng fips compliant ways create sha256 hashes, neither seem support creation of keyed hashes. no, there not. here list of ones (scroll down fips.sys algorithms section). a work around i've used int past her

java - need noRepaint() when i validate() -

i have jscrollpane view. i'm doing chat application , it's why need have scrollbar maximum(). right maximum of view have validate before. when validate scrollpane automatic repaint doing. don't want repaint because makes double repaint when set scrollbar maximum : when scrollbar @ top , when bottom. my code : main.getwindow().getmainpanel().getscrollpanecenter().validate(); scrollpanecenter.getverticalscrollbar().setvalue(scrollpanecenter.getverticalscrollbar().getmaximum()); ps : want disable repaint of conponent or maybe have solution have reversed jscrollpane( have scrollbar bottom) . i'm doing chat application i'm guessing using a jtextarea or jtextpane. it's why need have scrollbar maximum(). you don't need validate or set scrollbar manually. juat append text bottom of document. see text area scrolling couple of solutions.

RESTful API design - /users/:userId/resourceType vs. /resourceType/?user=:userId -

i'm spinning tires bit , i'm curious know others have decided on given same scenario. to list of resourcetype user identified :userid restful api, uri pattern makes sense, if have resources addressed as: /users/:userid/resourcetype // return list of resourcetype :userid versus: /resourcetype/?userid=:userid // query list of resourcetype i keep thinking "do both" - feels impractical considering how many permutations possible complex resource models. is 'pick 1 , move on' scenario or there 1 that's pragmatically better other , i'm not seeing it? definitely don't both! you're making support work yourself. it's best if api provides 1 way thing. either work. depends on how tightly resource types coupled users. if there's tight coupling, (1) fine. if you're not sure, or if loosely coupled, (2) preferable.

graph - Excel Chart Include Future Data? -

Image
i have chart in excel keeps track of performance of site's seo, i'm not sure how chart update automatically input new data excel. have manually go in , modify series selection of chart takes consideration. is there way chart include automatically data in series add excel sheet in future? thanks! if don't want define table, can achieved using dynamic named ranges . basically, create defined name ( date , sales in following) using formulas tab, name manager (or define name), , modify series formula of chart make use of these defined names. the process outlined in following screenshot, defined name date defined as: =offset('update automatically'!$a$2,0,0,counta('update automatically'!$a:$a)-1) sales defined in same way (a changed b). the series formula is: =series(,'excel charts.xls'!date,'excel charts.xls'!sales,1) if need more examples, or tutorials, might search "excel dynamic named range". ozgrid,

c++ - Multiple render targets -

i creating d2dfactory with d2d1createfactory(d2d1_factory_type_single_threaded, &direct2dfactory); and using direct2dfactory create render target on main window using: direct2dfactory->createhwndrendertarget( d2d1::rendertargetproperties(), d2d1::hwndrendertargetproperties(windowhandle, size), &rendertarget ); i attempting draw multiple classes multiple parts of window, @ minute, holding list of of these classes , calling onrender every 1 of them , passing rendertarget param. is there better way this? can create more 1 render target, , render render targets main rendertarget ? what's current problem? boring of passing many render target parameters? think cheap creating multiple render targets, d3ddevice object in direct3d apps, every render-able class need device object manage resource , rendering work, common way pass device parameter each class instead of creating multiple devices. think on way.

java - Drawing text on envelope -

hy guys! i need little assist on because cant figure out i'm doing wrong. i'm working on envelope writing program. program have 4 jtextfield. name, city, addres, postal code. use keylistener on name jtextfield recognize enter button, , add new name jtextfield. (basicly, sets 2nd name jtextfield visible). total have 4 name jtextfield , others (city, address, postal code) total 7. has print jbutton, jtable viewing written envelopes waiting printing on. when use g.drawstring() use predefined x,y value changing dynamicly according names field's text length measured font metrics' stringwidth() method , calculating right side margin value.. whatever. main problem here: if (name.length() > address.length()) { g.drawstring(name, (250 - namecord_x) + 46, 214); //this working g.drawstring(city, (250 - namecord_x) + 46, 226); g.drawstring(address, (250 - namecord_x) + 46, 238); g.drawstring(postal

android - how to show next week of dates on button click -

please me im using source code http://www.androidhub4you.com/2012/10/custom-calendar-in-android.html below source code customize sample code show current week of dates in horizontal. when user click on next week button nextweek dates show .how show next week of dates on button click? , code not not show date after today see screen shot http://imgur.com/gstbz0x guy me code not show 1 august 2013 on thursday code how current week days in calender show on monday me public class mycalendaractivity extends activity implements onclicklistener { private static final string tag = "mycalendaractivity"; private textview currentmonth; private button selecteddaymonthyearbutton; private imageview prevmonth; private imageview nextmonth; button btnnextweek,btnpreviousbutton; private gridview calendarview; private gridcelladapter adapter; private calendar _calendar; @suppresslint("newapi") private int month, year; @suppresswarnings("unused") @sup