Posts

Showing posts from September, 2010

c - What does recv() return when using non-blocking sockets? -

if set socket non-blocking, should recv() if there no new data read? at moment, using , if statement see if received greater -1. seems block somehow if nothing received. code looks like: flags = fcntl(newfd, f_getfl); flags |= o_nonblock; fcntl(newfd, f_setfl, flags); while(1){ ... ... if( (recvbytes = recv(newfd, recvbuf, maxbuflen-1, 0)) > -1) { ... } } according manpage: if no messages available @ socket , o_nonblock not set on socket's file descriptor, recv() shall block until message arrives. if no messages available @ socket , o_nonblock set on socket's file descriptor, recv() shall fail , set errno [eagain] or [ewouldblock].

c# - How to integrate a Linq to Entity query that queries multiple entities in a repository and send data to View? -

i'm learning mvc, repository pattern , ef , need advice how best integrate method contains query queries multiple entities repository. at moment, have created repository class implements interface , uses instance of dbcontext retrieve data database using entity framework, 1 entity. edited... have getjourneys() method in repository, unsure how obtain journey details query in controller. can user details. public ienumerable<user> getjourneys() { var todaydate = datetime.now; //woking many many relationship //(join tables) in asp.net mvc/entity framework var viewmodel = j in dbcontext.users u in dbcontext.journeys u.departdate >= todaydate.date orderby u.departdate ascending select j; return viewmodel.tolist(); } below user entity public class user { [key, required] public int userid { get; set; } [maxlen

sql server - Java Resultset Not Showing Unicode (Chinese) Characters, But Showing as Question Marks -

i have following issue. java resultset not showing unicode (chinese) characters, showing other characters. sure characters stored/showing in microsoft sql server (as nvarchar). so seems retrieving issue. here code: protected string getstringvaluenonulls(resultset rs, string colname) { string ret = rs.getstring(colname); ret = new string(ret.getbytes(), "utf8"); system.out.println(ret); ... output print statement: so (so in db) ??? (张先生 in db) ??????9999 ( 建国门外大街9999 in db) ?? (北京 in db) 100010 (100010 in db) it showing english/ascii characters not chinese characters. noticed number of chinese characters equal question marks replaces with. i have tried before plain getstring(), , doing getbytes() conversion both producing same results. is missing, or maybe issue driver? please help. ----------------i added connection, didn't help: class.forname("com.microsoft.sqlserver.jdbc

c# - How to restart service remotely? -

i can start or stop service remotely .net project. connectionoptions options = new connectionoptions(); options.username = @"192.168.36.22\test"; options.password = "test"; managementscope scope = new managementscope(@"\\192.168.36.22\root\cimv2", options); scope.connect(); managementoperationobserver stop = new managementoperationobserver(); stop.completed += new completedeventhandler(stop_callback); try { string nameservices = "arcgis server"; wqlobjectquery query = new wqlobjectquery("select * win32_service name=\"" + nameservices + "\""); managementobjectsearcher find = new managementobjectsearcher(scope, query); foreach (managementobject spooler in find.get()) { spooler.invokemethod("stopservice", new object[] { }); spooler.invokemethod(start, "stopservice", new object[] { }); } } .... how can restart service? you use servicecontrol

what is the best and how declare const in function of c++ -

i have these code #include <iostream> using namespace std; class ex; class exx; class ex { public: int _val; int const *_p_val; void setptrval(int * const &val) { _p_val=val; } }; class exx { public: ex const *_ex; void setex(ex const &ex) { _ex=&ex; } }; int main() { ex x; int i=10; x.setptrval(&i); exx xx; xx.setex(x); int y=20; cout<<*(xx._ex->_p_val)<<endl; x.setptrval(&y); cout<<*(xx._ex->_p_val)<<endl; cout<<*x._p_val<<endl; return 0; } 1: can see, ex x not const of ex class . , ex const *_ex; pointer point ex const . why above ok? 2: const in void setex(ex const &ex) means can't modify ex in function body? 3: how fix setter function member pointer variable if want prototype above (suppose sercurity reason)? ok. if ex const *_ex; become ex *_ex; so, in setter function, want prototype not mod

php - Will Doctrine delete the object using remove() without calling flush()? -

in symfony2 application i've been running errors of type: e_error: allowed memory size of * bytes exhausted (tried allocate 32 bytes) that said, i'm in process of refactoring code, way i've found on how delete doctrine objects calling method remove() . according symfony's documentation: the method remove() notifies doctrine want delete row database, doctrine won't until call flush() my question is... can call remove() in same fashion use unset remove object memory? long don't call flush() ? if not, what's best way "unset" objects using "symfony way" things ? what looking telling doctrine stop referencing these objects php can free memory. not want remove database rows because php running out of memory ... read how detach entities , what different entities states , means.

javascript - How to play one video in jQuery tab and stop others? -

i have 4 jquery tabs, in each tab there 2 videos. how make 1 video play @ time , pause others? , how make video pause when switch new tab? this code jsfiddle /* play 1 video @ time */ $('video').bind('play', function() { activated = this; $('video').each(function() { if(this != activated) { this.pause(); } }); }); /* active tab */ var active = $( "#issuestabs" ).tabs( "option", "active" ); /* pause videos not in active tab*/ if (!active) { $("video").each(function(){ $(this).get(0).pause(); }); } can show me wrong? thanks! can use: $('.tab').on('click', function() { $('.tabcontent:hidden').find('video').each(function() { $(this).get(0).pause(); }); }); (where .tabcontent name of content panels hidden/shown, click function showed example since not know library using tabs.)

angularjs - A way of clicking on hidden elements in protractor end to end tests -

is there way click on hidden value in sub menu. able driver.findelement(protractor.by.xpath('/html/body/div/div/a')).mouseover.then(function() { ptor.findelement(protractor.by.classname('name').gettext().then(function(result) { expect(result).tobe('me'); }); }); when menu item not visible, or limited @ moment. if not possible there way around issue @ present. ok after long , painful search trying find answer question came across answer trying answer different question. most of documentation found explain must use actions in form of webelement , cast javascript , pass script element in form of array click action. well same kinds goes here few modifications. describe('', function() { var ptor = protractor.getinstance(); var driver = ptor.driver; it('', function() { var hiddenelement = driver.findelement(protractor.by.yourchosenlocator('')); driver.executescript("argume

cocoa - How do I find the height of a WebView's content at the current width? -

i want resize webview vertically fit content. how find out best height is? i tried looking @ webframe's frameview, that's size of view it's being displayed in, , [frameview intrinsiccontentsize] returns -1, -1. update: i can this: domnode *bodynode = [[[frame domdocument] getelementsbytagname:@"body"] item:0]; float scrollheight = [[bodynode valueforkey:@"scrollheight"] floatvalue]; ..but result never less height of webview, when content plainly shorter. the answer here: how resize webview according content? the key in comments accepted answer: resize webview small before getting size.

c# - Getting info from currently running unit test -

i have find info running unittest helper class' static method. idea getting unique key each test. i thought using testcontext , not sure if possible. exemple [testclass] public void mytestclass { public testcontext testcontext { get; set; } [testmethod] public void mytestmethod() { testcontext.properties.add("mykey", guid.newguid()); //continue.... } } public static class foo { public static getsomething() { //get guid test context. //return base on key } } we storing key on thread thread.setdata , problematic if tested code spawn multiple thread. each thread need same key given unit test. foo.getsomething() not called unittest itself. code calling mock injected unity. edit i'll explain context little bit, because seems confusing. the object created via unity entity framework's context. when running unit tests, context data in structure created foo.getsomething . let's c

java - Can't get the extra escape characters to work in GSM 7-bit alphabet. -

i sending smsc example string "[ ]" encodes byte[] in hex "1b3c201b3e" according gsm 7-bit alphabet "1b" character 10 characters , 3c "[" , 3e "]" accordingly won't print print correctly on cellphone prints " < >" because prints "1b" space , "<" = "3c" , ">" = "3e". also, can't print of weird characters "èéùìòÇØøÅå€Ã†Ã¦ÃŸÃ‰@¤¡Ã„ÖÑܧ¿Ã¤Ã¶Ã±Ã¼Ã " works fine greek chars. error or has specific smsc? byte[] correct or not? you need choose 1 data_coding (or encoding scheme) based on kind of characters need use. page 136 of smppv4 protocol spec document shows data codings can use. then example, if choose ucs2 can make msg.getbytes("ucs2") , set datacoding 8 , make ucs2 representable characters shown in phone. i think if need use gsm 7-bit alphabet need set datacoding 1, need gsm 7-bit alphabet encoder, string bytes, think not available i

Lightswitch can't connect to the database on local development (VS 2012) -

i have lightswitch installed in vs 2012. have sql server 2012 express localdb installed on machine. i created new project, add new table, , when run project following error: an error occurred while establishing connection sql server instance '(localdb)\v11.0'. network-related or instance-specific error occurred while establishing connection sql server. server not found or not accessible. verify instance name correct , sql server configured allow remote connections. (provider: sql network interfaces, error: 50 - local database runtime error occurred. error occurred during localdb instance startup: sql server process failed start. this config in c:\users\xxx\documents\visual studio 2012\projects\nightapp\nightapp\nightapp.server <add name="_intrinsicdata" connectionstring="data source=|sqlexpressinstancename|;attachdbfilename=|applicationdatabasepath|;integrated security=true;connect timeout=30;multipleactiveresultsets=true" />

javascript - How to use ended in .on -

im trying use ended in dynamically generated content on isn't working , idk why, code. $(document).ready(function() { $('.container').on('click','.videobox',function(){ var $this = $(this); var video = $this.next('video')[0]; if (video.paused) { $this.css({ opacity: 0 }); video.play(); } else { video.pause(); $this.css({ opacity: 0.5 }); } }).on("ended",".test",function () { alert('asd'); $(this).prev('.videobox').css({ opacity: 0.5 }); }); }); this html <div class="videobox" style="position: absolute; z-index: 500; background-color: #000; opacity: 0.5; width: 473px; height: 474px;"><img src="/image/camera.png" style="position: relative; top: 45%; margin-left: 160px;"></div> <video class="test" width="473" height=&quo

c++ - std::string and move_iterator -

i writing tokenizer split string , put each of fields inside vector . idea use string::find repeatedly. instead of using temporary string object, used move_iterator s, supposed original string see characters stolen algorithm processed it. didn't happen. this example code demonstrates i'm talking about: #include <vector> #include <string> #include <iostream> using namespace std; void print_strings ( const vector<string> & v ) { unsigned int = 1; ( const auto & s : v ) cout << "#" << i++ << "\t: \"" << s << "\"" << endl; return; } int main ( void ) { string base( "hello, example string, icescreams" ); /* vector populate strings */ vector<string> v; /* 1: copy of 'base' */ v.emplace_back( base ); /* 2: copy of 'base' using iterators */ v.emplace_back( base.begin() , base.e

java - Get the excel workbook password using Apache POI -

i trying read excel sheet of data, able data , read using hssfworkbook works well, able data. i have set password workbook, manually in excel sheet protect workbook "abcxyz" , while opening excel file ask me password , after password in correct lets me in write or read excel file. my question how password "abcxyz" in java program. hssfworkbook wb = new hssfworkbook(inputstream); wb.iswriteprotected();--> returns false. as far know, can use: (in excel 2003) poifsfilesystem pfs = new poifsfilesystem(new fileinputstream("yourexcelfile.xls")); biff8encryptionkey.setcurrentuserpassword("abcxyz"); hssfworkbook wb = new hssfworkbook(pfs); (in excel 2007) poifsfilesystem pfs = newpoifsfilesystem(poidatasamples.getpoifsinstance().openresourceasstream("yourexcelfile.xlsx")); encryptioninfo encinfo = new encryptioninfo(pfs); decryptor decryptor = new decryptor(encinfo); decryptor.verifypassword("abcxyz&qu

javascript - Looping through deep objects in ng-repeat -

i'm in angular , have object this. var items = [{ title: 'something', children: [ { title: 'hello world' }, { title: 'hello overflow' }, { title: 'john doe', children: [ { title: 'amazing title' }, { title: 'google it' }, { title: 'i'm child', children: [ { title: 'another ' }, { title: 'he\'s brother' }, { title: 'she\'s mother.', children: [ {title: 'you never know if i'm going have children'} ]} ]} ]} ] }]; i wan't loop through of these have this.     • something        • hello world        • hello overflow        • john doe           • amazing title           • google it           • i'm child               •               • he's br

node.js - Handling exceptions in express -

i'm having trouble understanding how handle seems pretty basic aspect of express. if have code throws exception in async callback, there no way can catch exception because try/catch block no longer in scope time callback running. in these scenarios browser hang until give stating server unresponsive. bad user experience. rather able return 500 error client. default express error handler apparently not handle situation. here sample code: var express = require("express"); var app = express(); app.use(app.router); //express error handler (never called) app.use(function(err, req, res, next) { console.log(err); res.send(500); }); app.get("/test", function(req, res, next) { require("fs").readfile("/some/file", function(err, data) { a.b(); //blow }); }); app.listen(8888); in above code, line a.b() throws "referenceerror: not defined" exception. defined error handler never called. notice err object returne

java - Get IMEI in GenyMotion emulator -

hi i'm developing android application runed on genymotion emulator , in application need device imei null value same logic works avd emulator or android smartphone telephonymanager telephonymanager = (telephonymanager) getsystemservice(context.telephony_service); imei = telephonymanager.getdeviceid(); with permission added manifest <uses-permission android:name="android.permission.read_phone_state" /> the .getdeviceid() is not reliable , yes returns null if emulator. found link might you. alternative link 1 link 2 link 3

browser - C# Webclient not working properly -

i've created simple tool can find sign option in websites (200 website list in arraylist). using webbrowser has problem of cache , cookie switched webclient. works fine when put breakpoints , debug when run normally, include websites doesn't have signup option. here code private void btnsearch_click(object sender, eventargs e) { timer1.enabled = true; timer1.start(); } timer1 code string st; private void timer1_tick(object sender, eventargs e) { st = ""; application.doevents(); try { st = lst[dataindex2].tostring(); using (webclient asyncwebrequest = new webclient()) { asyncwebrequest.downloaddatacompleted += asyncwebrequest_downloaddatacompleted; uri urltorequest = n

api - Arduino+WiFly shield failing to communicate to xively -

i have problem in delivering sensor data xively api via arduino uno v3 , sparkfun wifly shield. problem not in hardware, or in wifly shield library since can deliver data paraimpu server fine. the fundamental problem xively library not work sparkfun wifly library. relevant declarations (suggested xively in documentation) are: wiflyclient client; xivelyclient xivelyclient(client); this not work since wiflyclient declaration expects server , port, hence modified to: byte server[] = {173,203,98,29}; //api.xively.com ip address wiflyclient client(server,80); xivelyclient xivelyclient(client); this gives me error on compilation of : xively_sketch2_aug20a:60: error: no matching function call 'xivelyclient::xivelyclient(wiflyclient&)' /users/paultravers/documents/arduino/libraries/xively/xivelyclient.h:11: note: candidates are: xivelyclient::xivelyclient(client&) /users/paultravers/documents/arduino/libraries/xively/xivelyclient.h:9: note: xiv

vb.net - Extension method not being recognized -

i've got web application project in vb.net , trying add extension method use in in view. extensions.vb imports system.runtime.compilerservices namespace myapp public module extensions <extension()> _ public function getvalordefault(byval dict dictionary(of string, string), byval key string, byval defaultval string) string dim val string if (dict.trygetvalue(key, val)) return val end if return defaultval end function end module end namespace view.cshtml @code dim msgs dictionary(of string, string) = new dictionary(of string, string) msgs("foo") = "bar" dim val string = msgs.getvalordefault("foo", "bar") end code however, doesn't work, showing following error: 'getvalordefault' not member of 'system.collections.generic.dictionary(of string, string)&#

c# - Append input into text file instead of replacing it -

i'm trying take data 2 text boxes, , writing file without replacing current stuff there when button pressed. have far: private void button1_click_1(object sender, eventargs e) { using (streamwriter sw1 = new streamwriter("datanames.txt")) { sw1.writeline(textbox1.text); } using (streamwriter sw2 = new streamwriter("datanumbers.txt")) { sw2.writeline(textbox2.text); } } right takes input, , replaces whatever in files there 1 line, instead of adding list. help. use streamwriter constructor (string, boolean) constructor , pass true append. true append data file; false overwrite file. if specified file not exist, parameter has no effect, , constructor creates new file. in code pass true like: using (streamwriter sw1 = new streamwriter("datanames.txt",true))

php - Retrieving data submitted with Yii's CActiveForm -

i trying retrieve data form created using widget cactiveform. however, when click on submit button, no data written targeted url. how obtain submitted form data? <p>please list ages of members of household:</p> <div class="form offset3"> <?php $form = $this->beginwidget('cactiveform', array( 'id' => 'survey', 'enableclientvalidation' => true, 'enableajaxvalidation' => true, 'action'=>yii::app()->createurl('//survey_resp'), 'clientoptions' => array( 'validateonsubmit' => true, ), 'htmloptions' => array( 'class' => 'form-horizontal', ), )); ?> <div class="row"> <?php echo $form->labelex($model, 'age_1'); ?> <?php echo $form->textfield($model, 'age_1'); ?> &l

xml - XSLT missing some tags -

i'm writing generic xsl stylesheet previewing xml in system, works fine, cases skips span.label , span.value markup. so istance if there tag having children text - works. ( a > b+c ) if there tag text on first level, output text content omitting tag name. ( a ) also if there tag has 1 child has several children text - omit first level tag name, show second level tag name , show text content third level. ( a > b > c + d + e ) here xslt: <?xml version='1.0'?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/xsl/transform" version="1.0"> <xsl:template match="/"> <html> <head> <title>preview</title> <meta charset="utf-8" /> <style> .level { line-heigth: 20px; } .label { width: 150px; display:inline-block; background-color:#eee; margin-right:10px; margin-top:

php - Laravel 4 pretty ulrs not working -

i'm using xampp 1.8.3. my .htacces (in public folder) <ifmodule mod_rewrite.c> options +followsymlinks rewriteengine on rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^ index.php [l] </ifmodule> all "allowoverride" of httpd.conf set "all". uncommented: loadmodule rewrite_module modules/mod_rewrite.so i don't use virtualhosts (should i?). /public/index.php/something works /public/something not. what missing? are path's set right? check following open /app/config/app.php , check if value of url set right path, eg. 'url' => 'http://localhost/laravel', then open /public/.htaccess , add rewritebase rule under rewriteengine on line, eg. rewritebase /laravel/public/ hope helps :)

node.js - Calling nodejs scripts from the command line does not work -

this file test.js contains: console.log("hello stackoverflow"); this happens when attempt run it: $ ls test.js $ node test.js $ node test $ node "test" $ node "test.js" $ node --debug test.js debugger listening on port 5858 $ node --debug test debugger listening on port 5858 $ notice never works :( can run "node" , evaluate javascript statements line line whenever try run script above not work. i'm running os x 10.8 , brand new installation of nodejs. the solution problem uninstall node using: sudo rm -rf /usr/local/{bin/{node,npm},lib/node_modules/npm,lib/node,share/man/*/node.*} i installed brew on mac: ruby -e "$(curl -fssl https://raw.github.com/mxcl/homebrew/go)" and did brew doctor i fixed issues told me fix that, , did brew install node i restarted terminal, , node working.

Parsing multiple JSON requests in Ruby -

i'm trying parse multiple json objects in ruby. def processkey(key) obj = getjsondata(key) puts "got log: " + obj.to_s + "\n" @data = json.parse(obj) end i can see obj getjsondata correct everytime, json.parse keeps on returning first object parsed for example: for key1 -> getjsondata(key1) returns obj1 -> json.parse(obj1) returns hash1 key2 -> getjsondata(key2) returns obj2 -> json.parse(obj2) returns hash1 key3 -> getjsondata(key3) returns obj3 -> json.parse(obj3) returns hash1 why? looking around @ http://www.ruby-doc.org/stdlib-1.9.3/libdoc/json/rdoc/json.html , stackoverflow examples don't notice way clean json memory or need other exmaples. what doing wrong in regards json.parse? note, i'm using ruby on rail 1.9.3 -thanks, niru found mistake in code. had accidentally left data @data, incorrect since had done refactoring. correct code within method should've been: def processkey(key) o

iOS sqlite3 encryption/decryption performance -

we trying replace our own aes implementation use standard ios aes implementation (see will our app fips 140-2 compliant if use our own aes algorithm implementation? ). original aes implementation encrypts , decrypts on source data buffer, no new allocation/free. standard ios aes implementation, have malloc memory destination data buffer dynamically encrypt/decrypt data. worried frequent memory allocation , free result in memory fragmentation. current memory allocation size 1k 8k bytes (depending on ios disk sector size, fixed on 1 particular device), should times of 1k. allocation/free mixed memory allocation of other size, worried create lot of memory fragmentation. one way solve use local variable fixed size (really sqlite3 page size). problem page size range 1k 8k (depending on ios disk sector size, not sure if ios device reach 8k though) on different devices, mean have allocate 8k local buffer every time since need assign size @ compile time. or allocate smaller local buffer

Custom Javascript not functioning in Wordpress -

i created custom javascript (at first) generates sum of checked fields. however, when implement in wordpress - nothing. guess i'm overlooking something, can't seem able figure out. this javascript: <script type="text/javascript"> <!-- function show_selected_item_val($item) { var res1 = 0, res2 = 0, res3 = 0, res4 = 0, res5 = 0, res6 = 0, res7 = 0, res8 = 0, res9 = 0, res10 = 0; var res11 = 0, res12 = 0, res13 = 0, res14 = 0, res15 = 0, res16 = 0, res17 = 0, res18 = 0; if(document.all['q1'][0].checked) res1 = 1; if(document.all['q2'][0].checked) res2 = 1; if(document.all['q3'][0].checked) res3 = 1; if(document.all['q4'][0].checked) res4 = 1; if(document.all['q5'][0].checked) res5 = 1; if(document.all['q6'][0].checked) res6 = 1; if(document.all['q7'][0].checked) res7 = 1; if(document.all['q8'][0].ch

unicode - Anyone know how to use Regex in notepad++ to find Arabic characters? -

i trying detect arabic characters in webpage's html using notepad++ ctrl+f regular expressions. entering following search terms , returning characters. [\u0600-\u06ff] sample block of random text i'm working - awr4tgagas بqa4tq4twْq4tw4twtfwd awfasfrw34جَ4tw4tg دِÙŠَّØ© عَرqaw4trawfَبِÙŠَّ any ideas why regular expression won't detect arabic characters , how should go this? have document encoded utf-8. thanks! this happening because notepadd++ regex engine pcre doesn't support syntax have provided. to match unicode codepoint have use \x{nnnn} regular expression becomes: [\x{0600}-\x{06ff}]

objective c - Error using a file path in fopen on iOS -

i'm new objective-c, , have following problem in code: nslog(@"path: %@", _nomfile); //show--> path: /users/heberthdeza/library/application support/iphone simulator/6.1/applications/75184ce7-6ccd-4e5e-abd1-e150cb35164e/documents/discovery/ios-4f55a50d-a3c7-4090-9969-f186c0501f89-23172117.zvg file *fp; fp=fopen([_nomfile cstringusingencoding:nsasciistringencoding],"rb"); if (fp==null) { nslog(@"error"); } fopen returns null (and shows "error"). doing wrong?

html5 - How the Grid System works for full width page? -

how grid system works websites expand full size of browser (no matter how resize) while working 12 grid_ system? for example, take on these websites: http://vevo.com http://xfinitytv.comcast.net http://pinterest.com is there technical name this? why there's no many websites take advantage of full browse size? thanks the "technical name" you're asking called "fluid" layout. in terms of how achieve in bootstrap, answer depends on whether you're using v.2.x or newly released version 3. in version 2.x fluid effect obtained wrapping grid elements in "container-fluid" class. in release 3, "container" class fluid default. (see bootstrap: migrating 2.x 3.0 more.) as why more sites don't use fluid layout in most, that's rather subjective question. i'll comment personal experience (15 years in web design , development)> fluid design doesn't become problem until larger displays, having content s

php - Display data for specific ID -

i have been trying while figure out how display data specific row within database based on id. say want link survivaloperations.net/page/mso?p=contracts&id=# where id=# id of row pulling data in database how pull , display data database using link shown above? i tried google it, didn't know google find related things any or links references appreciated! here had tried: <?php if ($p == contracts) { $id = isset($_get['id']) ? (int)$_get['id'] : 0; // if $_get['id'] exists, return integer, otherwise use sentinel, id's start 1, 0 works if ($id != 0): // assume specific news item meaning know it's 1 result $query = 'select * contracts id=' . $id . ' limit 1'; // try use limit 1, no need add steps in database lookup endif; mysql_select_db('survival_contracts'); $result = mysql_query($query); //$result = mysql_query($query) or die(mysql_error()); // loop through results while ($row = mysql_fetch

getresponse - Codenameone getResponseData -

i have following code... // register new user connectionrequest r = new connectionrequest(); r.seturl(surlwebsvc); r.setpost(true); r.addargument("rest", "1"); // r.addargument("req", "register"); // r = register r.addargument("username", findfield(f, "txtusername")); r.addargument("password", findfield(f, "txtpassword")); r.addargument("firstname", findfield(f, "txtfirstname")); r.addargument("lastname", findfield(f, "txtlastname")); r.addargument("address", findfield(f, "txtaddress")); r.addargument("city", findfield(f, "txtcity")); r.addargument("state", findfield(f, "txtstate")); r.addargument("zipcode", findfield(f, "txtzipcode")); r.addargument("email"

YouTube C# API Upload Large Video -

i trying upload 500 mb video youtube, using c# api. on last line, receive argument null exception. uri, second argument, supposed be? here code: [webmethod] public string insertvideotoyoutube(filestream fs, string filename, string title, string description, string username, string password) { video newvideo = new video(); newvideo.title = title; newvideo.tags.add(new mediacategory("sports", youtubenametable.categoryschema)); newvideo.description = description; newvideo.youtubeentry.private = false; newvideo.youtubeentry.mediasource = new mediafilesource(fs, path.getfilename(filename), "video/x-ms-wmv"); var youtubeauthenticator = new clientloginauthenticator("kenticovideo", servicenames.youtube, new gdatacredentials(username, password)); youtubeauthenticator.developerkey = "xxx"; resumableuploader uploader = new resumableuploader(256); uploader.insert(youtubeauthenticator, new uri(&q

jquery - drag drop clone help needed for web form builder with postback -

i noobe, , seeking , example/help on making web form builder woofoo, in jquery. using help, plan able extend other icons/image/controls/packaged div content. can please show me how clone html elements drag, drop , post server. cloning/sorting html elements via drag n drop in jquery , jquery ui. (and subsequently extend nested div containers elements), edit text next, capturing html , posting html/div content bootstrap themeable with little success, have been looking @ minikomi/bootstrap-form-builder http://minikomi.github.io/bootstrap-form-builder , i'm finding hard follow or extend asp mvc. i broke down code js templating, backbone, getting lost after require.js, templating hard understand, can break down, or give me alternate example please optionally, end postback has captured in asp mvc i searching same thing , came across example: http://www.anupshinde.com/form-builder-part-2 it simple example should started it. follow documentation draggable - dro

python - Get row id in sqlite when iterating over a fetchall? -

i'm trying id of row iterate on it, can't seem figure out how. here's have. cursor = conn.cursor() cursor.execute("select * logs {} order created {} limit 0, {}".format(created_filter, settings.order, settings.limit)) logs = list() row in cursor.fetchall(): # want row id in here. here's create , write db. working except apparently row ids. file = settings.logs_path log_table_name = 'logs' pin_table_name = 'pins' conn = sqlite3.connect(file, check_same_thread=false) c = conn.cursor() log_schema = dict(rowid = 'integer primary key autoincrement', asctime = 'text', created = 'real', exc_info = 'text', exc_text = 'text', filename = 'text', funcname = 'text', levelname = 'text', levelno = 'integer', lineno = 'integer', module = 'te

java - Why can't wake up this thread -

i want test thread.sleep() method, , found interesting thing.. when invoke main() method , console print "usera sleeping..." , "usera waking...", means program awakened , when use junit method run same code main() method, won't print "usera waking..." ... appreciate can explain . package com.lmh.threadlocal; import org.junit.test; public class threadtest { public static void main(string [] args) { new thread(new usera()).start(); } @test public void testwakeup(){ new thread(new usera()).start(); } } class usera implements runnable{ @override public void run() { try { system.out.println("usera sleeping..."); thread.sleep(1000); system.out.println("usera waking..."); } catch (interruptedexception e) { e.printstacktrace(); } } } my guess junit tearing down test before sleep finishes, becaus

ios - What happens to View Controllers when iPhone is rotated? -

working on app, i'm running across problem causing app shut down without error messages. can't find wrong code, , happens when chain of events occur. here's happens: under navigation controller, if go @ least 2 views in, rotate iphone landscape, attempt go back, app crashes immediately. i've added debug nslog lines me understand problem, revealing view controllers not working thought did. when rotate phone (simulator), views in stack become notified of change? , can shed light why might causing crash? thanks!

coldfusion - AngularJS filtering causes circular dependency error when using pagination -

this how load data // loads entire list of metriclibs. function homectrl($scope, $http, $location) { $scope.data = []; $scope.pagesize = 100; $scope.currentpage = 0; $scope.lastpage = 0; // async $http.get('index.cfm/json/metriclib') .success(function(data) { $scope.data = data; $scope.lastpage = math.floor($scope.data.length/$scope.pagesize); }) .error(function(data) { console.log("data load error"); }) ; $scope.go = function ( path ) { $location.path( path ); }; $scope.numberofpages=function(){ return $scope.lastpage; } } this how show data without pagination (this works) <tr ng-repeat="datum in data | filter:search | limitto:pagesize" class="odd"> this me thing set starting point <tr ng-repeat="datum in data | startfrom:0 | limitto:pagesize" class="odd"> when second 1 get: [19:5

ios - Stop MKMapView from moving to user's current location when user moves the map -

i making app show places near user's current location. when user moves map, map moves user current location, on , on again. so, user can't see annotations on map, because if moves map, map goes current location. this doing right now: - (void)mapview:(mkmapview *)mapview didupdateuserlocation:(mkuserlocation *)userlocation { if (userlocation) { mkcoordinateregion region = mkcoordinateregionmakewithdistance(userlocation.coordinate, 1000, 1000); mkcoordinateregion regiondelmapa = [self.mapa regionthatfits:region]; if(isnan(regiondelmapa.center.latitude)) { nslog(@"bad region..."); }else { [self.mapa setregion:regiondelmapa animated:yes]; } } } i have tried other answers here, nothing happens. not desired behavior, how can stop updating user's current location? [self.mapa setregion:regiondelmapa animated:yes]; that line sets map region. you're executing code every time update, reseting area map co

How to point PATH to new version of ruby on Mac OS X to connect Octopress -

i on mac os (10.8.4), have system version of ruby installed (1.8.7). know can't remove because it's required system. however, interested in setting jekyll blog on github via octopress: http://octopress.org . requires ruby version 1.9.3, added via rbenv install 1.9.3-p385 it appears have worked (after few hours before realizing had uninstall , old version of wine via macports). however, when run localhost:~ dan$ ruby -v i get ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-darwin12.4.0] i used get ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0] but run git clone git://github.com/imathis/octopress.git octopress localhost:~ dan$ cd octopress and ruby-1.9.3-p448 not installed. install do: 'rvm install ruby-1.9.3-p448' i'm using rbenv rather rvm (but willing switch if made difference). run: localhost:octopress dan$ env cc=gcc rbenv install 1.9.3-p448 downloading yaml-0.1.4.tar.gz... -> http://dqw8nmjcqpjn7.cloudfront.net/

c# - Calculate 2 dataGridView and Update an SQL Data Table -

i have 2 datatables table_1 , table_2. what's wrong code? can't add in table_2 sum of stock table_1? when update once, have correct output. http://tinypic.com/view.php?pic=1632bs&s=5 when press update button once more, updates first row, shown in following pic: http://tinypic.com/r/350p6hd/5 private void txtid_textchanged(object sender, eventargs e) { sqlconnection csq = new sqlconnection("workstation id=;initial catalog=iridadb; integrated security=sspi"); sqldataadapter dsaq = new sqldataadapter(); dataset dsq = new dataset(); dsaq.selectcommand = new sqlcommand("select * table_1 left(id, " + txtid.text.length + ") = '" + txtid.text + "' order itemid asc", csq); dsq.clear(); dsaq.fill(dsq); datagridview1.datasource = dsq.tables[0]; datagridview1.allowusertoaddrows = false; binddatagridview2(); } public void binddatagridvie

php - How can I have Google Maps display a dialog if my location is outside of a polygon? -

if have area defined (polygon, image boundary, etc.) want able alert user if current position outside of geographic location / geofenced area in google maps. able determine location of user through html5 geolocation fine, need know how display alert if user using webpage outside of designated area. first time poster, please go easy on me. :) load geometry library google maps api. use containslocation utility method determine if user's current location within geofenced area. display alert user. for alert itself, have several options. easiest way use standard javascript alert call. use maps api infowindow or 3rd party lightbox overlay.

python - Django Meta class -

i'm new django. i'm learning writing first django app. when build following code (from tutorial) in sublime text 2: from django.db import models django.utils import timezone import datetime class poll(models.model): question = models.charfield(max_length=200) pub_date = models.datetimefield('date published') def __unicode__(self): return self.question class choice(models.model): poll = models.foreignkey(poll) choice_text = models.charfield(max_length=200) votes = models.integerfield(default=0) def __unicode__(self): return self.choice_text i error: traceback (most recent call last): file "c:\djangoprojects\blog\polls\models.py", line 5, in <module> class poll(models.model): file "c:\python27\lib\site-packages\django\db\models\base.py", line 93, in __new__ kwargs = {"app_label": model_module.__name__.split('.')[-2]} indexerror: list index out of range [finished in 0.3