Posts

Showing posts from July, 2011

Make Folders from Spreadsheet Data in Google Drive? -

i beginning learn javascript , google apps script. have looked @ , played few scripts, , attempting create own. want take list of students (name , email) , run script create "dropboxes", or folders uses name , shared email address. way, can submit work me in organized manner. have written rough script, know not work. i wondering if can give me tips? function createdropbox () { // current spreadsheet var ss = spreadsheetapp.getactivespreadsheet(); var data = sh1.getdatarange().getvalues(); // each email address (row in spreadsheet), create folder, name data class , name column, share email for(n=1;n<data.length;++n){ var class = sheet.getsheetvalues(n, 1, 1, 1); var name = sheet.getsheetvalues(n, 2, 1, 1); var email = sheet.getsheetvalues(n, 3, 1, 1); var folder = docslist.createfolder('dropbox'); folder.createfolder(class . name); var share = folder.addeditor(email); } } you've got basic structure of script right, it's semantics...

check XML node exists or not using javascript -

how check ' roster ' has no child values using javascript <club code="3rd1" tvcode=""> <name>3rd place team 1</name> <roster/> </club> <club code="3rd1" tvcode=""> <name>3rd place team 1</name> <roster> <player code="auq"/> </roster> </club> if can use jquery, you can parse using $.parsexml xmldoc = $.parsexml( "<xml></xml>" ); and can use find prefered node $(xmldoc).find("roster") and number of children via .children().length putting together var rosterschildren = $(xmldoc).find("roster").children().length; console.log(rosterschildren > 0); here sample fiddle .

css - Move a div element at the center of the outer div -

Image
i have 3 buttons , div element . want of them placed 1 below other . able center buttons unable center div . the buttons a ) facebook sharing button b ) twitter follow c) twiiter share d ) google+1 share after haveing done hardwork of implementing these buttons seems strange yes stuck @ simple display :( can me allign logically 1 below . code : <div id ="outer" class="text-center"> <img id = "share_button" src = "images/share_button.png" > <br/> <br/> <a href="https://twitter.com/ixxxxg" class="twitter-follow-button" data-show-count="false">follow @ixxxg</a> <br/> <br/> <a href="https://twitter.com/intent/tweet?text=&amp;url=https://twitter.com/ixxxxxg" class="twitter-share-button" data-lang="en">tweet</a> <br/> <br/> ...

sql server - Update a column of a table using another column of the same table -

i have 2 tables vehicle_table , vehicle_group_table vehicle_table --> has columns --> vehicleid,groupname,groupid vehicle_group_table --> has columns --> groupid,groupname i want update vehicle_table's groupid column joining vehicle_group_table on common groupname column update vehicle_table set vehicle_table.groupid = vehicle_group_table.groupid vehicle_table.groupname = vehicle_group_table.groupname but seems not working. update v set groupid = vg.groupid vehicle_table v join vehicle_group_table vg on v.groupname = vg.groupname you need correlate 2 tables via join. there other ways subqueries etc note: don't use aliases in destination/target columns in set clause suggested in other answers. fails in sql server not in sql server 2012 think behaviour changed for more complicated setup: sql update query using joins

ASP.NET - Calculate Math Expression from Textbox -

i'm developing asp.net application , need calculate maths expressions 16+25*(15.38-12.16) which entered in text box control , result in other text box or label or wherever. i tried of these, not of https://stackoverflow.com/questions/tagged/equation+c%23 is there possible way it? you might able use datatable.compute() can handle simple equations. should work: c# private double calcequation(string equation) { datatable temptable = new datatable(); var result = temptable.compute(equation, ""); } vb.net private sub calcequation(byval equation string) dim temptable new datatable() dim result object = temptable.compute(equation, "") end sub

php - How not to add current page to browser history -

i have little question. have login page after login redirects me different page. how can make page not added browser history when go third page, redirect me login page? heard html5's newest additions pushstate(), replacestate() don't know how use them or if suit problem. thanks. i suggest using bbq jquery, have used before project work , worked wonders me, uses pushstate(), replacestate() , getstate() mentioned, opposed using html5, work on ie http://benalman.com/projects/jquery-bbq-plugin/ hope work out!

android - How to replace old document with new document in mobile storage using download manager? -

my question need use sync function after every 15 minutes, want is, send doc_id web server , server return new doc_id fields, want replace old document new one. my code: public void updatefile(string doc_id) { try { soapobject subfolderrequest = new soapobject(namespace, update_file_method); subfolderrequest.addproperty("documentid", doc_id); soapserializationenvelope envelope = new soapserializationenvelope(soapenvelope.ver11); envelope.dotnet = true; envelope.setoutputsoapobject(subfolderrequest); httptransportse androidhttptransport = new httptransportse(url); androidhttptransport.debug = true; androidhttptransport.call(soap_action_update_file , envelope); soapobject subfolderresponse = (soapobject)envelope.getresponse(); log.i("subfolders", subfolderresponse.tostring()); for(int i=0; < subfolderresponse.getpropertycount(); i++) { so...

Google Plus sharing from android app -

i have been trying post on google plus stream since morning, not getting posted contents specified in deeplinkid content inside settext() gets posted. here code, intent shareintent = new plusshare.builder(this) .settext("hello android!") .settype("image/png") .setcontentdeeplinkid(offrdetails_data.get(0).offerlink, offrdetails_data.get(0).dealtitle, offrdetails_data.get(0).dealdescription, uri.parse(offrdetails_data.get(0).dealimage)) .getintent(); startactivityforresult(shareintent, 0); i tested code minimal mainactivity , worked: public class mainactivity extends activity implements view.onclicklistener { private button mbutton; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); m...

Errors when installing from iOS app store on some devices -

on ios devices following errors , warnings (among others) logged during install of our app app store. apr 3 12:13:45 my-iphone appstore[268] <error>: libmobilegestalt copysystemversiondictionaryvalue: not lookup releasetype system version dictionary apr 3 12:14:28 my-iphone installd[54] <error>: 0x2ffda000 handle_install: install of "/var/mobile/media/downloads/-4231485137084285600/7874227378640616565" requested itunesstored apr 3 12:14:29 my-iphone installd[54] <error>: 0x2ffda000 mobileinstallationinstall_server: installing app com.mydomain.myapp apr 3 12:14:29 my-iphone installd[54] <error>: 0x2ffda000 mobileinstallationinstall_server: staging: 1.01s; waiting: 0.00s; installation: 0.30s; ls sync: 0.02s; overall: 1.33s apr 3 12:14:31 my-iphone lockdownd[45] <warning>: sssqlitedatabase: not setup database: [14, /var/root/library/com.apple.itunesstored/kvs.sqlitedb] apr 3 12:14:39 my-iphone awdd[799] <error>: corelocation: clcli...

c++ - Looking for OpenGL ES framework for cross-platform development on Win/Linux/MacOSX/Android/IOS -

i have develop cross-platform multimedia application run on windows, linux, macosx, android , ios . application have able play audio/video content, display photos , graphs and, probably, show simple 2d animations. after lot of searching, seems "most portable approach" problem use c++ language , opengl es drawing apis, because both supported on pair of device/os, performance level , visual appearance should near same on each (group of) devices. obviously, know i'll have tweak appearance of app "scale" on different devices different display sizes , resolutions. know it's unrealistic demand exact same behavior piece of code on such different architectures. want minimize written code (e.g. rewrite of piece of interface first in c++, in java must avoided). i'm not expert in opengl es programming, looking @ samples, seems need framework have ready-made widget (menus, buttons, textboxes). i'd prefer not reinvent wheel. this low-budget project, i...

html - JavaScript Cookie not writing based on URL Attributes -

i wrote script creates cookie, , sets name , value based on form data ?docname= , the getvalue comes script gets form data: <script type="text/javascript"> <!-- hide old browsers function getvalue(varname) { // first, load url variable var url = window.location.href.replace(new regexp( "\\+", "g" ), "%20" ) // next, split url ? var qparts = url.split("?"); // check there querystring, return "" if not if (qparts.length == 0) { return ""; } // find querystring, after ? var query = qparts[1]; // split query string variables (separates &s) var vars = query.split("&"); // initialize value "" default var value = ""; // iterate through vars, checking each 1 varname (i=0;i<vars.length;i++) { // split variable =, splits name , value var parts = vars[i].split("="); // check if correct variable if (...

Java - How to access an ArrayList of another class? -

hello i'm beginner in java , question: have first class following variables: import java.util.arraylist; public class numbers { private int number1 = 50; private int number2 = 100; } and have class too: import java.util.arraylist; public class test { private numbers number; } my question here is: want store number1 & number2 variables arraylist, access arraylist class test. how can that? import java.util.arraylist; public class numbers { private int number1 = 50; private int number2 = 100; private list<integer> list; public numbers() { list = new arraylist<integer>(); list.add(number1); list.add(number2); } public list<integer> getlist() { return list; } } and test class: import java.util.arraylist; public class test { private numbers number; //example public test() { number = new numbers(); list<integer> list = number.getlist(); //hurray ! ...

web testing - How to fix a "WebScarab error 500" with Internet Explorer? -

i newbie web scarab , tried configure proxy in ie web scarab. after configure proxy in ie. tried make same configuration in web scarab using "get ie setting" button. after configuration, internet not working(in browsers) , see message in message tab -> web scarab shown below 6:23:41 listener-127.0.0.1:8008-3339(urlfetcher.fetchresponse): closing connection! 16:23:41 listener-127.0.0.1:8008-3338(urlfetcher.fetchresponse): http://www.google.com:80/ : 500 webscarab error what have scarab running? "get ie setting" intended clean installation, no ie changes made webscarab. by reconfiguring ie point webscarab, , importing ie's settings webscarab's upstream proxy, have configured webscarab use upstream proxy connection. results in loop, , webscarab cannot function. reset upstream proxy setting in webscarab empty, or correct settings company's proxy.

c# - Capture response of form post with input[type="file"] -

Image
i have following html code: <form action="@url.action("savepicture", "pictures")" method="post" enctype="multipart/form-data" id="savepictureform" target="my_iframe"> <input type="file" name="file" class="fileupload" multiple accept="image/*" /> </form> <iframe name="my_iframe" id="my_iframe" src="" class="hhidden"></iframe> the form used upload images. problem web.config on server has file content size limitation. if upload file of 10mb yet server accepts maximum 5mb, error. here's how error looks in chrome: i handle error in global.asax.cs this protected void application_error(object sender, system.eventargs e) { var exle = context.server.getlasterror() system.web.httpexception; if (exle != null && exle.webeventcode == system.web....

java - "The method put(Object, Object) in the type HashMap is not applicable for the arguments (String, boolean)" -

hm.put("billingenquiry",true); produces error the method put(object, object) in type hashmap not applicable arguments (string,boolean)". how resolve issue? you're using non-parametrized hashmap. try declare hashmap this: hashmap<string, boolean> mymap = new hashmap<string, boolean>(); also note cannot use primitive types in generic types. this: hashmap<string, boolean> mymap = new hashmap<string, boolean>(); ... incorrect , won't compile.

Azure Mobile Services-Authentication Error -

while trying log azure mobile service using authentication token error: "the authentication token's signature malformed or signed different key." using facebook authentication provider. what doing wrong here? p.s. i'm using windows 8 sdk windows store apps.

Three.js zoom to fit width of objects (ignoring height) -

i have set of block objects, , i'd set perspective camera entire width visible (the height big - that's ok, we're going pan , down). i've seen there number of questions close this, such as: adjusting camera visible three.js shape three.js - width of view three.js: object size respect camera , object position on screen how fit camera object threejs. how implement zoomall , make sure given box fills canvas area? however, none of them seem quite cover i'm looking for: i'm not interested in height, width (they won't same - size dynamic can presume height larger width) the camera.position.z (or fov guess) unknown, i'm trying equations round right way solve that (i'm not great 3d maths. in advance!) i able simplify problem lot, in case... since knew overall size of objects, able come suitable distance through changing camera's z position few times , seeing looked best. my real problem same z position gave different...

c++ - Does the standard guarantee, that std::string::resize will not do reallocate memory, if the new size is less than or equal to as the old one? -

i need make string empty , append chars it. std::string::clear() may realloc std::string::resize(0) realloc? standard's words didn't garentee it. i think best possible answer "notes" section @ http://en.cppreference.com/w/cpp/string/basic_string/clear . unlike std::vector::clear, c++ standard not explicitly require capacity unchanged function, existing implementations not change capacity. and if capacity unchanged, mean no allocation or freeing functions called. that's best can do, short of looking @ each , every implementation care about.

linux - Siege aborted due to excessive socket failure -

i have encountered problem whilst trying run off following cmd siege on mac os x 10.8.3. siege -d1 -c 20 -t2m -i -f -r10 urls.txt the output siege following: ** siege 2.74 ** preparing 20 concurrent users battle. server under siege... done. siege aborted due excessive socket failure; can change failure threshold in $home/.siegerc transactions: 0 hits availability: 0.00 % elapsed time: 27.04 secs data transferred: 0.00 mb response time: 0.00 secs transaction rate: 0.00 trans/sec throughput: 0.00 mb/sec concurrency: 0.00 successful transactions: 0 failed transactions: 1043 longest transaction: 0.00 shortest transaction: 0.00 file: /usr/local/var/siege.log can disable annoying message editing .siegerc file in home directory; change directive 'show-logfile' false. the problem may run out of ephemeral ports. remedy tha...

c# - SQL query runs, but not producing any results -

i have following query display student data in datagridview, doest seems display records @ all. code: public void setsql() { string connstr = "provider=microsoft.ace.oledb.12.0;data source=c:\\users\\jasper\\desktop\\autoreg\\autoreg.accdb;"; oledbconnection myconn = new oledbconnection(connstr); myconn.open(); dataset ds = new dataset(); //query ask string query = "select * student"; using (oledbcommand command = new oledbcommand(query, myconn)) { using (oledbdataadapter adapter = new oledbdataadapter(command)) { adapter.fill(ds); datagridview1.datasource = ds; myconn.close(); } } } edit: after seeing comment noticed error. assuming web application. you should use datatable data source, not dataset . set data source property first table in dataset's tables collection. in truth, can use dataset, it's not straightforward. allow user change ...

ruby - Rails as_json not including all associations -

for arguments sake, lets have legs object. i'm trying call as_json on , include associations - set correctly works in console. this have: @legs.as_json( :include => { :shoes => { :include => { :left_shoe => { :include => { :shoe_lace => {:include => :sock} } } }, :right_shoe => { :include => { :shoe_lace => {:include => :sock} } } } } ) for reason it's not including right_shoe. stops @ left_shoe. ideas? i think per comments right shoe @ wrong level. try this: @legs.as_json( :include => { :shoes => { :include => { :left_shoe => { :include => { :shoe_lace => {:include => :sock} } }, :right_shoe => { :include => { :shoe_lace => {:include => :sock} } } } } } )

javascript - Hide some divs (it won't take space) -

i have 5 divs. each time want 1 of them shown in middle of screen. problem hidden divs takes space. each div contain lot of information don't want create each time need show it. i used: visibility="visible" or visibility="hidden" . are there other possibilities? you need use display:none hide element layout instead, documented as: none - value causes element not appear in document. has no effect on layout. visibility:hidden leave invisible box , problem encountering. documentation: hidden - generated box invisible (fully transparent, nothing drawn), still affects layout. furthermore, descendants of element visible if have 'visibility: visible'. the default css display value <div> display:block , show <div> again, set element display:block . note there other values display , take care set it's original value (which might not default value).

oracle - OSB 11g: Admin console buttons are disabled -

i new osb , installed osb 11g on wls 11g , login /sbconsole weblogic admin. , $subject. have create user profile before. instance in project explorer page, addproject button disabled (all add/delete buttons disabled ). have missed here ? make sure click create in top-left corner start change session. when done changes need hit activate button in same top-left corner.

neo4j - Returning multiple nodes in cypher with Index lookup -

i have following cypher query being called multiple times. start n=node:myindex(name="abc") return n then somewhere else in code start m=node:myindex(name="xyz") return m my data base hosted in azure , having latency/performance issues. in order speed process, , reduce multiple round trips, thought combining multiple cypher queries single one. actually, getting 10+ nodes in lookup simplicity have decided show example 2 nodes below. start n=node:myindex(name="abc"), m=node:myindex(name="xyz") return n, m my goal can in 1 round trip instead of 10+. works if index lookup on all nodes succeeds. however, cypher query returns 0 rows if one index lookup fails. hoping null equivalent in n or m on missing node. however, no luck. please suggest doing wrong , workarounds reduce round trips. many thanks! you can use parametrized query lucene syntax , e.g.: start n=node:myindex({query}) return n and parametrize {'query...

php - Allowing 1 Directory on a Webserver to be accessed for Includes by others -

the circumstances this, have hosting package website, doesn't allow me access php.ini or httpd.conf. have taken on various clients, want keep current hosting packages. what want allow access directory on particular path, in domain, can keep php includes in. can share across various clients sites, don't have access sites , update files. a friend of mine mentioned curl , fopen add lag. possible use, , know little them, .htaccess document open directory read access include requests other web servers. want keep webspace secure possible. advice , please. remember accessing includes via curl/fopen using urls mean you're accessing php includes if regular php scripts. unless configure server serve .php files plain text in particular directly, include scripts executed, , output. e.g. include.php on centralized "include" server <?php function foo() { echo 'hello foo'; } some script on client site: <?php include('http://incl...

iphone - Newsstand Notification Server -

i working on first newsstand app. basic gist of there 2 xml feeds. if no subscription detected, loads free.xml has couple of free issues on it. if subscription receipt detected , valid, shows listing of current issues. xml has title, link, description, , pubdate tags in it. link located , app downloads , displays it. issue how send out newsstand notifications. know different regular push, in has ability trigger automatic downloads of new issues. use xtify.com standard push notifications, use guidance on how set notifications newsstand app. to trigger automatic downloads in newsstand app, have send key-value pair follows along other keys. new key content-available value 1 responsible invoking application in background. { "aps":{ "content-available":1, } } if current push notifications service provider allow add key, , good, otherwise have use own server , setup push notifications , add key payload. in addition this, make sure...

haskell - managing two libraries with cabal that depend on each other -

i've got following question: i've got 2 haskell libraries depend on each other, , both libraries managed cabal. corresponding cabal files this: library 1: name: lib1 version: 0.1 cabal-version: >=1.2 build-type: simple author: matthias library hs-source-dirs: src build-depends: base >= 4, lib2 ghc-options: -wall exposed-modules: <...> library 2: name: lib2 version: 0.1 cabal-version: >=1.2 build-type: simple author: matthias library hs-source-dirs: src build-depends: base >= 4, lib1 ghc-options: -wall exposed-modules: <...> installing 1 of libraries (here library 2) cabal install works: resolving dependencies... in order, following installed: lib2-0.1 (reinstall) warning: note reinstalls dangerous. continuing anyway... configuring lib2-0.1... building lib2-0.1... preprocessing libra...

javascript - jQuery save sortable list -

i've used jquery example: http://jqueryui.com/sortable/#connect-lists-through-tabs <script> $(document).ready(function() { $(function() { $( ".connectedsortable" ).sortable().disableselection(); var $tabs = $( "#tabs" ).tabs(); var $tab_items = $( "ul:first li", $tabs ).droppable({ accept: ".connectedsortable li", hoverclass: "ui-state-hover", drop: function( event, ui ) { var $item = $( ); var $list = $( $item.find( "a" ).attr( "href" ) ) .find( ".connectedsortable" ); ui.draggable.hide( "slow", function() { $tabs.tabs( "option", "active", $tab_items.index( $item ) ); $( ).appendto( $list ).show( "slow" ); }); } }); }); }); </script> the html: <div id="tabs"> <ul> <li>...

actionscript 2 - How can I simplify this small code with a loop in AS2 -

the following code want simplify: _root.botao1.onrelease = function(){ follow=1; } _root.botao2.onrelease = function(){ follow=2; } _root.botao3.onrelease = function(){ follow=3; } i have tried implement following code: for(i=0;i<3;i++){ _root['botao'+i].onrelease = function(){ follow=i; trace(follow); } } although should work, when trace current follow value return in '3', no meter if click on 1 or 2. how can fixed? the reason buttons print same value because onrelease functions reference same variable i, contains value 3 when loop has finished executing. an easy solution store value of each iteration of loop variable on clickable object: for(i = 0; < 3; i++) { var mc : movieclip = _root['botao' + i]; mc.follow = + 1; mc.onrelease = function(){ trace(this.follow); } } another solution might bit harder grasp define anonymous function , cal...

forms - changing a variable based on dropdowns that also doesn't refresh page -

what i'm trying accomplish have simple form has dropdowns priced items in them. when user changes dropdown option change "base price" of overall product. ^^ working ^^ the kicker work without refreshing page because right i'm using this.form.submit() on < select >. reason being, if user @ bottom part of page , select option take them top of page when want keep them going on selecting more options. i've tried ajax methods of not refreshing page, , got work "post" variables don't work. can't keep running total of base price. any ideas appreciated. i understanding need submit without refresh, please see tutorial: http://net.tutsplus.com/tutorials/javascript-ajax/submit-a-form-without-page-refresh-using-jquery/

regex - perl regular expression to get the text between 5) some text 6) -

5) on 64bit os go c:\program files (x86)\common gateway 6) on 32 bit in above example trying text between 5) , 6) on 64bit os go c:\program files (x86)\common gateway i have written following 5[)]\s?(.*?)6[)]\s?/i getting fail here have (x86) expression match on 64bit os go c:\program files (x8 so thinking adding [^\/] skip x86)\ not working out...can 1 please help. if read question correctly, want match 6) unless 6) part of string (x86) . in case, use negative look-behind assertion: /5\)\s?(.*?)(?<!\(x8)6\)\s?/i which say, ... match until 6) unless (x86) .

apache - JMeter - Iterative use of variables via CSV -

i having trouble, how put jmeter test , ensure customer numbers assigned each thread being used? my load test... • there 12 soap requests (12 x requesttypes ) need sent simultaneously each customer. customer distinguished customernumber in soap request. example: <execute> <usercredentials></usercredentials> <customernumber></customernumber> <requesttype></requesttype> </execute> • have 3 thread users, , each thread user each has designated list of customers, example: thread 1 has customer list – a, d, g, j, … thread 2 has customer list – b, e, h, k, … thread 3 has customer list – c, f, i, l, … • thread cannot send set of 12 soap request customer, unless response has been retrieved of previous 12 soap requests customer (it not matter if response soap, or application, failure) • customernumber , respective usercredentials stored in csv file. • thread user must use own credentials in soap request. • requ...

javascript - Toggle Color based on RGB or Hex values of DOM element -

why following code not toggle element color when button clicked? assumption style.color returning object of sorts , not string. best way correct issue. in advanced! <!doctype html> <html> <head> <script> function myfunction() { asd=document.getelementbyid("demo") if (asd.style.color!="rgb(255,0,0)") asd.style.color="rgb(255,0,0)"; else asd.style.color="rgb(0,0,0)"; } </script> </head> <body> <h1>my first javascript</h1> <p id="demo"> javascript can change style of html element. </p> <button type="button" onclick="myfunction()">click me!</button> </body> </html> browser vendors return various versions of style.color value. from quick test on page (which pasting code javascript console can see yourself): ie8 returns "#888" document.queryselectorall('div[class="user-details"]'...

javascript - tabblable inside tabbable twitter bootstrap -

im making admin panel... many forms want clasify category im trying this div.tabbable ul#first-tab.nav.nav-tabs li.active a(href='#datos-de-usuario',data-toggle='tab') datos de usuarios li a(href='#datos-de-comercio',data-toggle='tab') datos de comercio div.tab-content div#datos-de-usuario.tab-pane.active div.tabbable.tabs-left ul#second-tab.nav.nav-tabs li.active a(href="#formulario-nuevo-usuario") nuevo usuario li a(href="#formulario-borrar-usuario") borrar usuario div.tab-content div#formulario-nuevo-usuario.tab-pane.active h2 tab nuevo usuario div#formulario-borrar-usuario.tab-pane h2 tab borrar usuario div#datos-de-comercio.tab-pane ...

What is the best authentication mode for asp.net application using SQL Server 2005 Express? -

i have inherited asp.net 2.0 application uses sql server 2005 express database , grappling authentication mode. i have read windows authentication more secure , locally works fine. use default machine account , trusted connection in connection string similar : value="trusted_connection=true;server=mymachinename\sqlexpress;database=databasename;pooling=false" on server though, find myself having grant more privileges aspnet user (execute, update) in database , wondering if makes sense after all. login verification handled application. does make more sense set database user , use credentials in connection string? acceptable connection string? value="server=myservername\sqlexpress; database=mydatabase; user id=myusername; password=mypassword;" if you’re not in need high security you’ll doing fine sql authentication. try connection string instead <add name="connstring" connectionstring="data source=myservername\sqlexpress; i...

exception - ClientProtocolException Android -

so trying browse localhost webpage android device. when put following url in android browser works: http://192.168.x.x/timecode but when try access via httpget, this httpclient client = new defaulthttpclient(); uri website = new uri("http://192.168.x.x:8000/timecode"); httpget request = new httpget(); request.seturi(website); httpresponse response =client.execute(request); raises exception org.apache.http.client.clientprotocolexception and when looked @ stacktrace saw interesting think might have exception org.apache.http.parseexception: unable parse status code status line http/1.1 what intend content of page i'm trying access , simple this: { "currenttime": "00:00:02" "videoid": "video2" } i have no idea wrong. know not because of url because works n every browser im guessing has httpclient have no idea what. can please me on 1 ? thanks

complexity theory - Get an O(N) algorithm to find a product of a collection of numbers with a strange constraint -

this question when participated recent interview, think interesting. let's int n=10; input : array int a[10]; output: array float b[10]; requirement: b[0]= a[1]*a[2]*...a[9]; // product of numbers in a, other a[0]; b[1]= a[0]*a[2]*...a[9]; // product of numbers in a, other a[1]; .... b[9]= a[0]*a[1]*...a[8]; // product of numbers in a, other a[9]; .... problem: how can array b populated without using division operator / ? , o(n) algorithm? i tried quite few methods, still in vain. ideas? firstly, calculate left , right products: left[i] = a[0]*a[1]*...*a[i] right[i] = a[i]*a[i+1]*...*a[n-1] note left[i] == left[i-1] * a[i] , left array can computed in linear time. simlarly, right array can computed in linear time. from left , right , array b can computed in linear time b[i] = left[i-1] * right[i+1] special cases i == 0 , i == n .

Can I save cookie values with other data during form process in Rails? -

i have set 3 cookies in rails controller information visitor when land on site. when submit form, need values of these 3 cookies saved in database table along other form data. have run migrations add columns i'm not finding that's helpful in saving values on form submission. does know if possible and, if so, how this? def process_contact_us @form = form.find(1) @contact_submission = contactsubmission.new(params[:contact_submission]) if @contact_submission.save if @contact_submission.newsletter begin logger.info "sending autoresponder" et = exacttarget.new(applicationcontroller::et_user,applicationcontroller::et_pass, true) et.add_subscriber_with_options({ "email__address" => @contact_submission.email, "first__name" => @contact_submission.first_name, "last__name" => @contact_submission.last_name, "address" => @contact_submission.address, ...

r - Add axis annotations in ggplot2 -

Image
i have ggplot2 graph datetime on x axis, , categorical on y axis. need put 9 text annotations @ dates on x-axis, there no space put annotations within graph itself. want keep auto generated dates on x-axis, , add custom labels too. don't care if they're @ top or bottom. synthetic example below. have 9 events, , lots of activity leading these events. want put text label indicating event name below each event. eg in data @ feb 11th @ midnight want have label says "event 1" somewhere. events <- data.frame(names=c("event 1", "event 2", "event 3", "event 4", "event 5", "event 6", "event 7", "event 8", "event 9"), dates=strptime(c("2013-02-10 11:59 pm", "2013-02-21 11:59 pm", "2013-03-02 11:59 pm", "2013-03-16 11:59 pm", "2013-03-26 12:00 pm", "2013-04-11 11:59 pm", "2013-04-24 11:59 pm...

java - Difference of List and ArrayList in declaration? -

this question has answer here: type list vs type arraylist in java 14 answers list versus arraylist reference type? 3 answers is there difference between these two? if so, it? list<integer> x = new arraylist<integer>(); and arraylist<integer> x = new arraylist<integer>(); the first declaration lets program interface. ensures later on can safely replace arraylist with, say, linkedlist , , rest of code going compile. the second declaration lets program class, potentially use methods of arraylist not implement list interface. example, can call ensurecapacity() on list declared arraylist , not on list declared list . although programming interface should preferred, there nothing wrong doing if must call class-specific methods: example, a...

javascript - SetTimeout issue in Node.js -

i've following code runs fine under chrome (v8) fails inside node: var id; id = settimeout("timeouthandler()", 10); console.log ('set'); function timeouthandler() { cleartimeout(id); console.log ('clear'); } chrome output: set clear nodejs output: set timers.js:110 first._ontimeout(); ^ typeerror: property '_ontimeout' of object [object object] not function @ timer.listontimeout [as ontimeout] (timers.js:110:15) any ideas why? thanks unlike in browsers, settimeout in node.js not accept string parameter. must pass function. example: function timeouthandler() { cleartimeout(id); console.log ('clear'); } var id; id = settimeout(timeouthandler, 10); console.log ('set');

# in query string breaks php GET -

running problem form have built. user typed in hash (#) address in address field. when address put query string after form submitted of variables broke after field #. know why happen? need convert # different character or use other type of encoding? code have on page grabs values query string.. <?php echo $_get["address"]; ?><br/> // if field has # in value, variables below not work.. <?php echo $_get["city"]; ?><br/> <?php echo $_get["state"]; ?> a # valid anchor symbol in url , has meaning client browser. in likelihood should using post form rather get, @ point issue goes away. usually rule of thumb use url parameters (get) cases want url navigable user , such navigation not change data on server (or things trigger emails, etc.). example of might use of product id's in url e-commerce catalog application determine product show on page. you should typically use post cases going change data on server ...

sql server 2008 - Why does mathematical operation in SQL return 0 -

why calc value not calculated in tsql query below? select d1, d2, (d1+d2) 'sum', ((d1/(d1+d2))*100) calc (select 3 d1, 6 d2) this result get: d1 d2 sum calc ----------- ----------- ----------- ----------- 3 6 9 0 the integer division rounding zero move 100. still rounding. if cannot tolerate rounding don't use integers. select d1, d2, (d1+d2) 'sum', d1/(d1+d2) frac, (d1*100)/(d1+d2) pct (select 3 d1, 6 d2)

java - Is there any generic based alternatives for setting parameters in PrepareStatement -

i developing database application. using java.sql combined h2 embedded database. develop don't repeat yourself way. set reuseable database row class , database property class follows: public class databaseproperty { private string propertyname; private t value; private boolean identifier; public databaseproperty(string propertyname, t value, boolean identifier) { this.propertyname = propertyname; this.value = value; this.identifier = identifier; } public string getpropertyname() { return propertyname; } public t getvalue() { return value; } public void setvalue(t value) { this.value = value; } public boolean isidentifier() { return identifier; } } and... public class databaserow { protected connection dbconnection; protected string tablename; protected hashset = new hashset<>(); public databaserow() //with above variables. apologies being lazy type ;) //here's problem part //...

mail server - Custom mailing list system -

on our website use mysql table contains users. of users should able send mails users. unfortunately haven't got right idea how implement such system. my current design: a privileged user writes mail users@website.com using personal mail software. a server waiting incoming mails. as receives mail, matches 'from' field database. if user not found or hasn't got special flag, discard mail. forward mail users (mail addresses saved in database) send sender confirmation mail. how can implement such system? i'm not required stick programming language though c++, php or node.js preferred. as jumping off point, imap/smtp. can, language, log email inbox, emails, read them, etc etc etc. set mailbox account users@website.com receives legitimate emails. set cron job checks inbox every 5 minutes or so. if no emails found, done. if there email there, process it, run checks against db, , send using smtp, , send confirmation user. if handling imap ...

java - copy only portion of char[] into String -

i have array char[] ch. question following. how can merge values ch[2] ch[7] string? achieve without looping through char array. suggestions? thanks taking time answer question. use new string(value, offset, count) , reference . where offset starting index , count index difference. in case, it's 7-2=5. obviously, value character array.

html - Image size on different device width for mobile site -

how take care of image sizes on different devices mobile site. responsive design 1 of answers. can read more concept here http://en.wikipedia.org/wiki/responsive_web_design here post making images responsive http://css-tricks.com/which-responsive-images-solution-should-you-use/ and, of course, take around site ;) css - how make responsive images

ajax - Webgrid: URL for Sorting and Filtering -

i have webgrid in partialview. parial view contains ajax form pass data webgrid. view looks like using (ajax.begin("gain", "gaining", new ajaxoptions{updatetargetid="res"})) { } <div id="res"> <div id="grid"> @{var grid = new webgrid(source: model.mylist, canpage: true, rowsperpage: 25, ajaxupdatecontainerid: "grid", cansort: true); grid.pager(mode: webgridpagermodes.all)); @grid.gethtml(htmlattributes: new { id = "grid" }, columns: grid.columns( grid.column(columnname: "num", header: "number"), grid.column(columnname: "name", header: "full name", cansort: true) )); } </div> </div> the page displays wells sorting , moving next page not work. when try, grid dissapears. notice when hover on column header, when hover on header sorting links, url still localhost:xxxxx/#. when remove a...

bash - Finding the DISK space for all the server instances -

in bash script, server list has list of serers disk space should calculated. ranging c1 c109. servers c100-c109 has capacity below 50%, have following message says "there sufficient disk space available" but, getting message instead "i seem running nonexistent amount of disk space" please if can me fixing this, awesome. let me know, if clarifications need. here script below: #!/usr/bin/bash # script simple test checking disk space. vtier in `cat serverlist` space=$(ssh -q ${vtier}@${vtier} 'df -kh|grep ${servername}|cut -c 65-70') echo "checking disk space.... in ${vtier}" case $space in [1-6]*) message="there sufficient disk space available - $space full" ;; [7-8]*) message="keep eye on disk space - $space full." ;; 9[1-8]) message="better hurry new disk - $space full." ;; 99) message="i'm drowning here! - $space full" ;; *) message="i seem running nonexistent amount of disk space ...

python - django-haystack - filter not working for value 'a', but working for other letters and words -

i have index this; class indexclass(searchindex): text = charfield(document=true, use_template=true) f1 = charfield(model_attr='f1') lets say, f1 has values 'a', 'b', 'c', 'sdfsdf', 'sd' (different lengths of letters, words). able filter this: searchqueryset.filter(f1='b') (not 'b', other except 'a' working) but, when try letter 'a', not working. where think problem ? by way, tried modify values manytimes, , when modify value 'a', not working.

c# - Resubscribe IObservable after merge -

i have iobservable listening 1 source: _itemschanged = observable.merge(item1.observeitemchanged); _itemschanged.subscribe(_ => console.writeline("item changed")); as app runs, additional items might added , want merge new item's stream existing one: var item2 = new item(); _itemschanged.merge(item2.observeitemchanged); however, see output when item1 changed. have refresh subscription somehow? expected merged stream picked right away. the basic idea use subject<iobservable<t>> subscribed to. lets add more items on fly. here way abstract bit (the subject subject<item> project , merge observable<t> ): var subject = new subject<item>(); iobserver<item> newitems = subject; iobservable<t> itemschanged = subject.selectmany(item => item.observeitemchanged); itemschanged.subscribe(_ => console.writeline("change")); // add items newitems.onnext(item1); newitems.on...

Matlab: Series of Variables in a Loop -

this solution stackoverflow participant helped me out. data coming csv file: states damage blizzards indiana 1 3 alabama 2 3 ohio 3 2 alabama 4 2 %// parse csv file [states, damage, blizzards] = textread(csvfilename, '%s %d %d', ... 'delimiter', ',', 'headerlines', 1); %// parse data , store in array of structs [u, ix, iu] = unique(states); %// find unique state names s = struct('state', u); %// create struct each state k = 1:numel(u) idx = (iu == k); %// indices of rows matching current state s(k).damage = damage(idx); %// add damage information s(k).blizzards = blizzards(idx); %// add blizards information end in matlab, need create series of assigned variables (a1,a2,a3) in loop. have structure s 3 fields: state, tornado, hurricane. now have attempted method assign a1 =, a2 =, got error because not work structures: n = 1:numel...

css - padding issue in Firefox -

http://www.pcdconsultancy.co.uk/ im having trouble menu. appears have @ least couple of pixels bigger on firefox ie or chrome, can advise me appears be? ive tried tweak seems still out. my menu css : #headermenu { margin-top: 9px; margin-left: 80px;} #headermenu ul {background: #efefef; padding: 0px; margin: 0; list-style: none; display: inline-table; } #headermenu ul li { float: left; background: -moz-linear-gradient(top, #999999 0%, #3a3a3a 100%); /* ff3.6+ */ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#999999), color-stop(100%,#3a3a3a)); /* chrome,safari4+ */ background: -webkit-linear-gradient(top, #999999 0%,#3a3a3a 100%); /* chrome10+,safari5.1+ */ background: -o-linear-gradient(top, #999999 0%,#3a3a3a 100%); /* opera 11.10+ */ background: -ms-linear-gradient(top, #999999 0%,#3a3a3a 100%); /* ie10+ */ background: linear-gradient(to bottom, #999999 0%,#3a3a3a 100%); /* w3c */ filter: progid:dximagetransform.microsoft.gradient( startcolo...

multithreading - How do you change DataGridView properties and values with threads in vb.NET? -

i have been beating head against wall 2 weeks now, while trying figure out way navigate through rows of datagridview component threads. want this, because if gridview more 300+ rows long ui hang 30-60 seconds. i new multi-threading, know importance of thread safe applications , having make sure changes ui components done on ui thread. the steps want take follows(unless has better suggestion): user selects item in listbox disable ui interaction user the datagridview broken searchable ranges search through each range in parallel , hide rows match items selected in listbox. resume ui interaction user ultimately want beable select multiple items in listbox hide or show them. what looking give me idea start? should go background worker, task parallel library, custom threads, ect...?

variables - Reading a number from a multi-line txt document in c++ -

i'm making program, , have .txt file need read from, , commands from. text document looks like: u r f 10 d f 13 q and need numbers out of it. way im reading file ifstream object named instream . i'm using while(instream.get(charvariable)){ switch(charvariable){ case 'f': //do forward command break; ... } } the forward command needs take line, does, , needs read f , skip space, , whole number int variable. i'm new c++, need doing that.... how number, read single char variable, integer variable? great! thanks streams move read them. means when have read f stream next input integer . , since work on formatted input stream skip white space when use >> while(instream >> charvariable)){ switch(charvariable){ case 'f': //do forward command int nr; instream >> nr; // number. break; ... } }

mongodb - comment system rdbms vs nosql -

what best way implement commenting system (huge data writing)? 1) use rdbms database such mysql, 2 tables 1 topics , 1 comments pros insertion of new comment fast, efficient , simple, efficient indexing. cons scaling out (horizontal scaling) hard. 2) use nosql database such couchdb or mongodb, pros scaling out (horizontal scaling) easy, supports huge data writes, schemaless cons i think insertion of new data not fast , efficient rdbms for example update couchdb document need grab whole document, update locally submit again, , document size huge consume bandwidth. also think couchdb in-place updates, mongodb updates slow , won't efficient in rdbms also when want comments of each user in various topics think search faster in rdbms in nosql system. that sample of couchdb database document [document sample each topic] {"_id":"doc id", "_rev":"45521231465421" "topic_title":"the title of topic" "t...

ios - Show only some of the objects in an Array -

i want only show of items in array, can't figure out how it. this code have shows objects in array: @property (strong, nonatomic) nsarray *springs; @property (strong, nonatomic) nsmutablearray *leafs; - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"standardcell"; uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier]; spring *spring = [springs objectatindex:indexpath.section]; // 13 objects leaf *leaf = [spring.leafs objectatindex:indexpath.row]; // 30 objects cell.textlabel.text = league.shortname; return cell; } so show 5 of 30 leaf objects array created, , not show of them. there way that? (i'm using api pull items array) thanks help, post specific code or other info needed! edit added per request: - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section { s...