Posts

Showing posts from July, 2010

javascript - Jquery ajaxForm() doesn't fire 'success' although it works successfully -

today trying send files via ajax request using jquery ajaxform plugin. however, doesn't fire success function uploads file without javascript run time or compile time error. here code: <table id="haberresmiekle"> <form action="action.asp?kmt=resimyukle" method="post" enctype="multipart/form-data" id="haberresmiekleform"> <tr> <td><input type="file" name="file"></td> </tr> <tr> <td><input id="b" type="submit" value="gonder"></td> </tr> </form> </table> and <script> $("#haberresmiekle").dialog({autoopen:false,title:"resim yukle"}); var options={ target:"#haberresmiekle", success:function(){alert('x');$("#haberresimekle").dialog('close');} }; $("#haberresmiek...

Java finally block and throws exception at method level -

in readfilemethod1 , ioexception explicitly catched before throwing @ method level ensure finally block executed. however, neccessary catch exception? if remove catch block, shown in readfilemethod2 , finally block executed well? private void readfilemethod1() throws ioexception { try { // io stuff } catch (ioexception ex) { throw ex; } { // release resources } } private void readfilemethod2() throws ioexception { try { // io stuff } { // release resources } } the finally still gets executed, regardless of whether catch ioexception. if catch block rethrow, not necessary here.

matlab - Problem concatenating a matrix of numbers with a vector of strings (column labels) using cell2mat -

i'm mac user (10.6.8) using matlab process calculation results. output large tables of numbers .csv files. use .csv files in excel. works fine. the problem each column of numbers needs label (a string header). can't figure out how concatenate labels table of numbers. appreciate advice. here further information might useful: my labels contained within cell array: columnsheader = cell(1,15) that fill in calculation results; example: columnsheader{1} = propertystringone (where propertystringone = 'liq') the sequence of labels different each calculation. first attempt try , concatenate labels directly: labellednumberstable=cat(1,columnsheader,numberstable) i received error concatenated types need same. tried converting labels/strings using cell2mat: columnsheader = cell2mat(columnsheader); labellednumberstable = cat(1,columnsheader,numberstable) but took separate labels , made them 1 long word... leads to: ??? error...

javascript - Set height of an element on multiples of a number? -

is there way via jquery or javascript make element stretch height set of numbers? mean, accommodates more content, height follow pattern of numbers (multiples of number). let's in multiples of 100... div's height extends taller in series -- 200px, 300px, 400px, etc. hence, if exceeds 1 pixel off 200, automatically resize 300. it's hard explain. i need because made vertically seamless pattern torn edges , totally perfect if shows each tile completely. i know basic jquery , don't have bit of idea on how work out. my sincerest gratitude whoever tends query! var h = $('div').height(); $('div').height( math.ceil(h/100) * 100 );

c# - Set object's nested object's proerty as combo valuemember -

i have combobox. datasource list of objects. class has public property class defined me. set combo's valuemember property of class. how can that? class b { public int id {get; set;} } class { public b anyproperty {get; set;} public string name {get; set;} } var testlist = new list<a>() {...}; combo.datasource = testlist; combo.displaymemver = "name"; combo.valuemember = ??? //it should a.anyproperty.id .net4/vs2010/c# thx combo.valuemember = "anyproperty"; combobox bind object. can value doing this. var selectedvalue = (b)combobox.selectvalue; please not above sytax maybe incorrect.

groovy - Grails - 404 File not found - but why? -

i start write simple login formular. code view: <g:form controller="login" action="checkusernameandpassword"> <input type = "text"name="usernamefield" value="username"/> <input type = "password"name="passwordfield" value="password"/> <input type = "submit" name="loginbutton" value="login"/> </g:form> this code controller: class logincontroller { def index = { render(view: "login") }//endmethod index def checkusernameandpassword = { [username = params.username ,password = params.password]; }//endmethod checkusernameandpassword } as can see, doesnt yet, wanted print values on screen, 404 message (i run file on local host) the requested resource (/projectname/hello/checkusernameandpassword) not available. i cant figure out why. great if of guys have tip me. beste regards, daniel ...

javascript - Jquery menu slide up from from bottom of screen on hover -

i want show menu phrases "music, newsletter, contact" fixed @ bottom of screen. on hover want them slide , reveal hidden content. here's mean: http://sorendahljeppesen.dk/ see bottom of screen. know how accomplished? thank you. p.s. also, know type of mp3 player is? put hidden content div such as; <div class="hiddencontent">...</div> then give links @ bottom of page class such as; <a href="#" class="bottomlink">music</a> then tell jquery show hidden content when hover on link; $('.bottomlink').hover( function () { // show hidden content if not showing if($('.hiddencontent').css('display') == 'none') { $('.hiddencontent').slideup('slow'); } }, function () { // nothing when mouse leaves link $.noop(); // nothing } ); // close menu when mouse leaves hidden content $('.hi...

c++ - how to modify private members that are const? -

i know sounds strange question, bear me. i have custom class has large objects need returned reference avoid copy. my class looks this: class csv_file { public: csv_file(std::string); //constructor std::string const& access(int,int) const; void modify_element(int column,int row ,std::string value) { storage.at(row).at(column)=value; } private: mutable std::vector < std::vector<std::string> > storage; }; the code access is: string const& csv_file::access(int column,int row) const { return storage.at(row).at(column); } when try compile this, error, wants csv_file::modify_element(int column,int row ,std::string value) const {} in practice, storage logically const, need able modify once in while. there way this? also, related question. if call modify_element modify element in storage, previously, have returned reference element using access, reference returned pick new value after ...

css - Horizontal list with nested lists that display vertically -

i'd display following: <ul class="parent"> <li>a <ul class="child"> <li>a1</li> <li>a2</li> <li>a3</li> </ul> </li> <li>b <ul class="child"> <li>b1</li> <li>b2</li> <li>b3</li> </ul> </li> </ul> like this: *a *b *a1 *b1 *a2 *b2 *a3 *b3 i've tried few variations of using inline , float, can't find way child menus expand vertically , line right using css. html (fixed) <ul class="parent"> <li>a <ul class="child"> <li>a1</li> <li>a2</li> <li>a3</li> </ul> </li> <li>b <ul class=...

android - OnClick ImageView with OnFling ViewFlipper -

i have viewflipper holds single imageview. want able swipe change image / view, , click image play sound. i have gesturedetector handling onfling change view. tried put onclicklistener imageview, worked stopped onfling working. lastly, added onsingletapconfirmed gesturedetector. worked, registers click anywhere in activity not imageview. can suggest how narrow down onsingletapconfirmed work on imageview? here's code far: class mygesturedetector extends simpleongesturelistener { @override public boolean onfling(motionevent e1, motionevent e2, float velocityx, float velocityy) { try { if (math.abs(e1.gety() - e2.gety()) > swipe_max_off_path) return false; // right left swipe if(e1.getx() - e2.getx() > swipe_min_distance && math.abs(velocityx) > swipe_threshold_velocity) { log.v("swipe", "right left"); viewflipper.setinanimation(slide...

winforms - DataObject GetDataPresent(format) returns true, and GetData(format) return null -

here's full setup i'm trying do: have activex control on web page (ugh), , want save it's view image, , post server. activex control not support directly, have take more round-about method. the platform: ie8, windows 7, uac/ie protected mode off. this method sending activex control message copy current view clipboard. once has done that, launch application via protocol handler (e.g. app:clipboard/blah/blah). program supposed grab data off clipboard right format (jpeg), , post url. the code i'm using testing this: var dataobject = clipboard.getdataobject(); trace.writeline("data formats on clipboard: " + dataobject.getformats().aggregate(" ",(s,v)=>s+v+ " ")); foreach (var fmt in dataobject.getformats()) { trace.writeline("getdatapresent on " + fmt + ": " + dataobject.getdatapresent(fmt)); trace.writeline("getdata on " + fmt +": " + !(dataobject.getdata(fmt,true)==null)); } whi...

windows 7 - GetProcAddress doesn't work for functions other than void -

i have problem getprocaddress: wrote simple dll 1 function in it: extern "c" lresult winapi function(hwnd hwnd, uint message, wparam wparam, lparam lparam) { beep(1000, 1000); return callnexthookex(0, message, wparam, lparam); } when try function's address getprocaddress fails errorcode 127 (error_proc_not_found). however, if use void function type works perfectly. can't figure out why behaves this. suggestions appreciated! btw: dependencywalker shows function's name indeed "function" no changes have been applied. there 2 failure modes getprocaddress: you didn't export function you didn't name right the exported named of function not "function" unless used .def file rename export or created 64-bit dll. "_function@16" 32-bit build. @16 postfix associated fact have trouble making work functions arguments. from visual studio command prompt run dumpbin.exe /e...

vb.net - LINQ Query for filter by Selected Items in Checkbox List -

could not find through google or in questions... i have checkbox listbox on form. want filter list list of selected ids listbox checked, in sql have done "where typeid in (1, 4, 5, 7)"... how do in linq? i feel missing obvious answer, cannot it. for argument sake... here have sample data: in colors (list<of currentcolors>) id, name, typeid 1, red, 1 2, blue, 1 3, green, 2 4, pink, 3 selected types 2 , 3 in checkboxlist: filteredcolors filteredresults = (from c in workitemmonitor ????).tolist() expected items in filteredresults be: [3, green, 2], [4, pink, 3] edit: current query.. (sorry told list, turns out datatable filtering) dim workitemslisting datatable workitemslisting = (from l in workitemmonitor.asenumerable() _ clbstatus.checkeditems.contains(l.item("currentstatusid"))).copytodatatable() list<currentcolor> colors = chklistcurrentcolors.checkeditems.cast<currentcolor> (); filteredresults = (from c in workitemm...

sql - EF 4.1 Code First: Execute Stored Proc and return IDENT -

i'm attempting use context.database execute stored proc inserts record , returns identity. know proc works, using either output parameter, select, or return, cannot either executesqlcommand or sqlquery<int> return identity. using stored proc return, insert tablea (fielda, fieldb) return scope_identity i see return value of 1010966 ssms declare @return_value int exec @return_value = spinsertrecord select 'return value' = @return_value but nothing have done in application returns valid value. int64 result = context.database.executesqlcommand always returns 3 , casting error referencing decimal when using sqlquery<int> . made attempt output parameter, wasn't able code execute properly, have focused on app consuming either select scope_identity or return scope_identity short of creating models replace logic contained in stored procedure, i'm open , suggestions returning value both stored proc , application level. here h...

android createBitmap OOM when ((freeMemory > bitmapSize) && (nativeFreeHeap < bitmap size)) -

on android 2.2, following program produces oom. in summary, program following: allocates big array requires native heap grow close maximum size. garbage collects array. attempts create bitmap of size larger remaining native free heap. why fail oom? it's if native heap allocate memory bitmaps in memory unallocated. the output appears below program. in advance. public class oomtest extends activity { private static final string oom_test = "oomtest"; /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); printdiag(); log.i(oom_test, "allocating big int array."); int[] bigintarray = new int[11000000]; printdiag(); bigintarray = null; log.i(oom_test, "garbage collecting."); system.gc(); printdiag(); log.i(oom_test, "crea...

vb.net - Win 7 Phone MMS .Net -

i wondering if knew how update mms settings via code on windows 7 phone. have seen apps out there update settings hd7 phone. suggestions our appreciated. i highly doubt there non-oem third party apps did that. app saw must've been htc themselves, have more access standard thiry party developers.

rubygems - Downloading Tweets into Ruby on Rails database -

i'm trying build app in ruby on rails stores specified tweets in database. i think i'm going use twitter gem, i'm not sure how go displaying tweets storing them. any or resource links appreciated! and database best suited application? when iterating results, can store them in model objects, in turn map tables in sql databases (mysql, postgres, oracle), or documents in nosql dbs mongodb. tweaking example in twitter gem's readme : # find , store 3 recent marriage proposals @justinbieber twitter::search.new.containing("marry me").to("justinbieber").result_type("recent").per_page(3).each |r| mylocaltweetmodel.create!(:from_user => r.from_user, :text => #{r.text}") end this can done database, really. the decision on database use depends on many other factors, such app hosted, traffic expect, how plan scale it... , taste 1 of these factors, , not unimportant one. hate active record migrations, instance, tho...

sql server - Boolean Logic in Select Clause -

evidentally, can't this: select sum( t.myfield null ) totalnulls, sum( t.myfield '[0-9]') totalnumbers mytable t; i don't know why these don't work, since booleans in sql numbers (0 , 1). errors i'm getting suggest not legal have 'is null' or 'like' anywhere in select clause. why aren't legal there? how achieve intended effect, suggested (pseudo) sql above? if data isn't indexed on queried column should use case-based solution aaron recommended because rows queried once. select totalnulls = sum(case when myfield null 1 else 0 end), totalnumbers = sum(case when myfield '[0-9]' 1 else 0 end) mytable; you should know accept e.g. '7' number not '12' in case. if want accept numbers you'd have ask ... when myfield not '%[^0-9]%' ... in case charm using isnumeric: select totalnonnumbers = count(*) - sum(isnumeric(myfield)), totalnumbers = sum(isnumeric(m...

c++ - dynamic_cast to the same type does not check type of object -

i trying determine whether object pointed t* pointer t object, or other, unrelated type. tried dynamic_cast, less useless, returns pointer instead of null when obvious not point valid t object: object* garbage = reinterpret_cast<object*>(0x12345678); if( dynamic_cast<object*>(garbage) == null ){ cout << "expected behaviour (by me)" << endl; }else{ cout << "you've got kidding me" << endl; } is there workaround this, or other solution? i've tried casting void* , char* before dynamic_cast no avail, typeid not enough either since want accept subclasses well. some context: i'm writing custom array class implementing shallow conversion between different kinds of arrays, array<object*> , array<string*> , , guarantee minimal type safety doing dynamic type check @ every element access, example: #define debug array<string*> v(10); array<object*> o = v; o[0] = new integer(1); // ...

java - drawable from an url with honeycomb -

from beginning used method : public drawable createportrait(string url){ try { inputstream = (inputstream)new url(url).getcontent(); drawable d = drawable.createfromstream(is, "image"); return d; } catch (malformedurlexception e) { // todo auto-generated catch block e.printstacktrace(); return null; } catch (ioexception e) { // todo auto-generated catch block e.printstacktrace(); return null; } } but honeycomb doesn't allow me anymore, see in log : android.os.networkonmainthreadexception . thing url taken json data : private class graburl extends asynctask<string, void, void> { private final httpclient client = new defaulthttpclient(); private string content; private string error = null; private progressdialog dialog = new progressdialog(main.this); protected void onpreexecute() { dialog.setmessage("downloading source.."); ...

gzip - Java Compress Large File -

i'm working on app works large files each around 180mb , there 3 of them. add option app these files compressing them in zip or tar or something. best option compress them down as possible in java? tar? zip? gzip? you can programmatically using apache compress .

php - Get last 3 words from the string? -

how last 3 words string? i managed working doing this: $statusmessage = explode(" ", str_replace('&nbsp;'," ",$retstatus->plaintext)); $slicedate = array_slice($statusmessage, -3, 3); $date = implode(" ", $slicedate); echo $date; is there shorter way? maybe there php function did not know.. explode() good, once you've done can use $size = sizeof($statusmessage); and last 3 $statusmessage[$size-1]; $statusmessage[$size-2]; $statusmessage[$size-3];

c++ - How to get the Linux Flash ROM size in C? -

is there c/c++ library or linux system command can use rom size? on start-up kernel displays proper size in mb. can't seem find can pull from thanks -naze by way, im using jff2 rom file system on embedded system. arm7 cpu. if appears mtd device, can following cat /proc/mtd dev: size erasesize name mtd0: 00030000 00010000 "bootloaders" mtd1: 00200000 00010000 "kernel" mtd2: 00280000 00010000 "rootfs" mtd3: 00350000 00010000 "user" size in hexadecimal for more information on individual mtd, find them in /sys/class/mtd<n> directory

objective c - Is there a method for adding one NSString for NSData? -

i'm working on writing file 1 user input on textfield. far have 1 nsfilemanager writes data file. still, have no way of putting textfield input inside file. is there way add string value nsdata can write it? you can nsdata nsstring, nsdata *newdata = [yourstring datausingencoding:nsutf16stringencoding]; use encoding fits case. append obtained data existing nsdata, [existingdata appenddata:newdata] note: "existingdata" should instance of nsmutabledata.

Sproutcore nested array one to many binding -

i have 3 tiers of objects, each 1 many. i'd like, when different notebook selected, page , column view elements cascading updates. notebook > pages > columns with notebookscontroller , notebookcontroller can bind app.notebook = sc.record.extend({ name: sc.record.attr(string), pages: sc.record.tomany('app.page', {ismaster: yes, inverse: 'notebook'}) }); app.page = sc.record.extend({ pagenumber: sc.record.attr(number), notebook: sc.record.toone('app.notebook', {ismaster: no, inverse: 'pages'}), columns: sc.record.tomany('app.column', {ismaster: yes, inverse: 'page'}) }); app.column = sc.record.extend({ columnnumber: sc.record.attr(number), page: sc.record.toone('app.page', {ismaster: no, inverse: 'columns'}) }); following this, can't seem content binding pagescontroller work. want contents of pagescontroller, pagecontroller, columnscontroller, , columncontroller cascade...

c# - How to handle parameter changes in webservice versions -

i'm relatively new webservices , c# not programing (lots of experience in legacy systems). i've got closed loop system - write webservice , consuming application - on pda. web service published , pda app, use "add new web reference" feature in vs. i can use code like: appname.com.mydomain.webservicename s = new appnamecom.mydomain.webservicename(); s.somemethod(param1, param2); all well...until discover need update 1 of webmethods take 3 parameters when used take 2. if change webservice , publish, existing pda's fail on call until new version of pda software. hundreds in field, can't update them @ once nor want require them update @ same time. solution 1: add version number webservice method somemethod has somemethodv2(1,2,3) update pda software use s.somemethodv2 solution 2: copy existing "webservicename" webservicenamev2, has somemethod(1,2,3) change pda software reference appname.com.mydomain.webservicenamev2 @ point when kn...

xmlhttprequest - jquery xhr success and error states -

what xhr states jquery accepts success states? error states? know 200 success state , 401 error state. further information on helpful. can please point me read. not information jquery api. when can't find answer in the docs , dive the source . here's bit you're looking for, line 2: // if successful, handle type chaining if ( status >= 200 && status < 300 || status === 304 ) { // set if-modified-since and/or if-none-match header, if in ifmodified mode. if ( s.ifmodified ) { if ( ( lastmodified = jqxhr.getresponseheader( "last-modified" ) ) ) { jquery.lastmodified[ ifmodifiedkey ] = lastmodified; } if ( ( etag = jqxhr.getresponseheader( "etag" ) ) ) { jquery.etag[ ifmodifiedkey ] = etag; } } // if not modified if ( status === 304 ) { statustext = "notmodified"; issuccess = true; // if have data } else { tr...

caching - C++ simple cache design for function output -

i assume it's quite frequent problem well-known solutions, wasn't able find. i'm seeking advice here. problem statement consider following setting: class a; // class const f(const a&); // _expensive_ function void do_stuff() { a; a.modify(...); do_stuff1(f(a)); // compute f(a) do_stuff2(f(a)); // use cached value of f(a) a.modify(...); do_stuff3(f(a)); // recompute f(a) } i return value of f(a) cached between first , second calls, discarded after second call a.modify() . edit: in practice, calls f(a) in different scopes. here pieces of solutions i've explored, it's worth. solution 1: central cache using time stamps i can imagine simple solution involving adding time stamp class a function f can check , decide if needs update cached result, stored somewhere in central cache. guess implies changing signature of f to: const a& f(const a&); problem 1: central cache, need mechanism destroy cache...

php - Foreach strpos problem. Find string in another string -

i'm trying script work. the idea if input string ($query) doesn't start '/t' , contains 1 of $trigger words, $error set. i can't work , i'm not sure why. <?php $error = false; $triggers = array('sell', 'buy', 'trade', 'trading'); $query = 'buying stuff'; if (!empty($query)) { if (substr($query, 0, 2) != '/t') { foreach ($triggers $trigger) { if (strpos($query, $trigger)) { $error = true; } } } } if ($error) { echo "fail"; } else { echo "pass"; } ?> that should have triggered error doesn't seem be. doing wrong? if function strpos fails find string returns false . note if search string found @ beginning 0 returned. change if (strpos($query, $trigger)) { to if (strpos($query, $trigger) !== false) { ...

c# - Crystal Report using local database -

i m creating crystal report in c# using local database. have done connections. when run application, datas r inserted in table. table data not binded in crystalreportview. in advance... please try following link, crystal report 1 crystal report 2 if want more please ask me....

iphone - Getting a coordinate on an imageview -

after searching way drop pin onto imageview mapview i've come conclusion it's not possible. thought can simulate pin drop creating multiple imageviews, hold png image of standard pin, on fly. now, want create imageview , place user taps.(gesture type not important now). know can touch coordinate. need not this. need have annotation pins in place time close , relaunch app. think i'll have plist @ least dictinary hold coordinate on imageview key , callout or popview value. how place pre arranged pins on viewdidload method correct coordinates?thanks ahead. there 2 (may more ) approaches. 1->you use nsuserdefault save setting , read them in next launch .. 2-> nsdictionary , have alreay mentioned. to save setting ... nsdictionary *mydict = [[nsdictionary alloc] init]; // fill setting data in dictionary here ....................................... [[nsuserdefaults standarduserdefaults] setobject:mydict forkey:@"mymapdict"]; [[nsuserdefaults s...

.net - How to safely save file to disk without the risk of windows reject it? -

i'm developing winform application. want take input user (i.e. user provides username) , use input part of filename , save file. how check if username provided user didn't contain windows' reserved characters. , list of reserved characters windows? via: path.getinvalidfilenamechars() and path.getinvalidpathchars() the exact list could platform-specific (especially mono), , includes non-printable characters... showing them here tricky ;p

log4j appender relative to the path of my maven project -

i'm trying define log4j appender saved in current maven project (for dev only). not want appender end in deployed webapp, in actual maven project, next sources, regardless of webapp deployed (locally of course). i have tried various maven (and non-maven) variables no luck. is there variable i'm missing simply? appreciated. thanks. have tried putting ${basedir} or ${basedir}/target logfile location in log4j.properties? should filtered during build.

mongodb - Is it possible to define an int32 value in javascript console? -

do understand right impossible define , store int32 value in mongodb javascript console? if want have no choice write program in java or other language well-typed driver interface? the more or less clear explanation find bug #854 in mongodb's jira. can't believe such simple , vital feature avoided. it's worse that, if retrieve data in js console , write db, convert interegers floats. afaik new feature fix still not implemented . new feature implemented in 1.9.1: var intvalue = numberint(3);

Adding an unescaped query parameter in C# -

i trying add unescaped parameter url of uribuilder. how can prevent characters of parameter escaped? query.set("oauth_signature", consumer_secret + "%26"); builder.query = query.tostring(); the resulting url contains % escaped sequence oauth_signature value (which %25 apparently). %26 & right? why not query.set("oaut_signature", consumer_secret + "&");

jquery - Stop ENTER from submitting the containing form in Autocomplete plugin by Jorn Zaefferer -

i use jorn zaefferer's autocomplete jquery plugin works great except 1 thing - if user using keyboard scroll through autocomplete options list , presses enter on 1 wants, submits containing form. im sure cleverly placed return false; sort out - have ideas? $('#myform').submit(function(e) { // validate form fields here }); the above @ least ensure no matter how form submit triggered, can capture , suppress if necessary.

postgresql - importing osm file into a postgres/postgis database -

im using tool osm2pgsql import osm file postgres database using phppgadmin administrative tool. have downloaded small town osm in xml format , im having trouble importing using terminal on mac. im bit of noob @ appreciated. ive looked @ several articles none provide clarity need in order fulfill needs. thanks im getting error small not sure.. using projection srs 900913 (spherical mercator) setting table: planet_osm_point notice: table "planet_osm_point" not exist, skipping notice: table "planet_osm_point_tmp" not exist, skipping select addgeometrycolumn('planet_osm_point', 'way', 900913, 'point', 2 ); failed: error: function addgeometrycolumn(unknown, unknown, integer, unknown, integer) not exist line 1: select addgeometrycolumn('planet_osm_point', 'way', 900913, ... ^ hint: no function matches given name , argument types. might need add explicit type casts. you need install postgis exte...

c# - How to select a field with linq on datarow -

i have linq query : string title = datarow r in (oledb.dataitems.tables[0]).rows select r.title; and i'd extract field title (from database) on row (rows 1, not more, that's put on string , not in string[]. how can it? vstudio says datarow doesnt contain definition of title, field title exist on database. i making confusion :) as frédéric hamidi said, don't need linq. however, if still want way (overkill) , know there single table single row, do: dataset data = new dataset(); var table = (from in data.tables.cast<datatable>() select a).single(); var row = (from in table.rows.cast<datarow>() select a).single(); string title = row.field<string>("title"); or dataset data = new dataset(); var table = (from in data.tables.cast<datatable>() select a).singleordefault(); var row = (from in table.rows.cast<datarow>() select a).singleordefault(); string title = row.field<string>("title"); i...

PowerShell Copy on a mapped or UNC Drive (SQL Server Job Agent) -

what doing wrong? as step in job trying overwrite file copying drive mapped, using unc path in case. in powershell works in command line interface. copy \v240\folder\foo.txt \v240\folder\bar.txt 1 when put in job agent in sql server powershell option says completed file has not been copied. the powershell sql agent job step starts powershell sqlps host in sql server provider. try setting location (cd) filesystem provider before copying set-location c:\ copy \v240\folder\foo.txt \v240\folder\bar.txt

java - JTable , Celleditor , how do i startCellEditing? -

i have jtable , couple of cells rows ( 1 column ) have textboxes on double clicking particular cell , user can edit cell have separate edit button part of application editing cells since there no "startcellediting" method on getting getcelleditor (only stopcellediting there ) if call editcellat(row,column) method (on clicking edit button ) removing existing content , user has enter entire content again . how behavior ? inshort , instead of user double clicking cell edit , clicks on edit button , how achieve same behavior ? this code not clears cell content on button click import javax.swing.*; import javax.swing.table.defaulttablemodel; import java.awt.*; import java.awt.event.actionevent; import java.awt.event.actionlistener; public class test extends jframe { public test() { defaulttablemodel tablemodel = new defaulttablemodel(); tablemodel.setrowcount(2); tablemodel.setcolumncount(2); tablemodel.setvalueat(...

Does all browsers support .svg image format -

is .svg replacement .jpeg or others? can secure images .svg format.? , browsers have suport .svg svg supported major browsers ie8 , later versions need plugin display image , free. their vector based structure allows display them on many different devices various screen sizes without losing visual information. , more compressible jpeg , gif images

html - Problem with dynamic checkbox to relate with corresponding textbox -

i have 1 form user can dynamically add new text box. each textbox, have 1 checkbox (for option show or hide in frontend). it's below. <ul> <li><input type="text" name="field_name[]" /></li> <li><input type="checkbox" name="show_hide[]" /></li> </ul> <input type="button" value="add more field"> when post value php, confused how can related checkbox corresponding textbox since array of checkbox 'show_hide[]' may depends upon user input. you use index: <ul> <li><input type="text" name="field_name[0]" /></li> <li><input type="checkbox" name="field_name[0]" /></li> </ul> and jquery, every time add new text box , checkbox set name show_hide[index] etc. store index globally , update when new text box added, or use regex parse previou...

regex syntax diagram -

i'm still new reading regex , finding pretty hard read. remember finding website before convert regex syntax digram (although i've tried several times find again, growing increasing concerned might have imagined it). i wondering if knew of tool or website able convert regex syntax diagram? thanks. you might interested in http://regexplained.co.uk converts regular expressions rail-road diagrams

php - I want to find friend relationship in mysql -

possible duplicate: friend of friend in php/mysql? i use mysql , php. have 2 tables : table user: id (int) name (varchar) table contain user's friend: user_id (int) friend_id (int) the question : if have 2 user id, let's id = 101 , id =1000 how can know relationship between these 2 id ? id 101 friend of friend of friend id 1000 or ? in facebook/ friendster, how come can generate select * user inner join friends on friends.user_id = user.id user.id = '101' , friends.friend_id = 1000

sql server - Comparing sql query resultsets in java -

i want run query programmatically using java on sql server database running on our dev environment , production environment , compare results. doing column column comparison best way compare resultsets or there better way ? thank you comparing resultsets work. other option create object each resultset , compare that. define equals method handle this, other ordinary java object. much of depend on want produce in end. if you're concerned resultset 1 being different resultset 2, either method work.

JPA/Hibernate using associated object in setters while fields are null -

my code looks this. why name in setchildren() null ?? public class node { private string id, name, parentname; private set<node> children = new hashset<node>(); private node parent; private set<string> childrennames = new hashset<string>(); @id @generatedvalue public string getid() { return id; } public string getname() {return name;} @manytoone @joincolumn(name="parent_id") public node getparent(){retrun parent;} @onetomany(cascade=cascadetype.all, mappedby="parent", fetch=fetchtype.eager) public set<client> getchildren(){return collections.unmodifiableset(children)} @transient public string getparentname() { return parentname;} @transient public set<string> getchildrennames() {return childrennames;} // problem here ------------ public void setchildren(set<node> children) { this.children = children; for(node child ...

android - multiuser application managing back stack of each user -

everybody i work on multiuser application, rest client, when launch it, 1st activity see loginactivity. for example, have ten activities , loginactivity , can navigate e.g. next way: loginactivity -> activity1 -> activity3 -> activity8(logout) -> loginactivity. can log out every activity. possible next situation: 1) user1 logged in: loginactivity -> activity1 -> .. activity7(logout) -> loginactivity. 2) user2 logged in: loginactivity -> activity1 -> .. activity4(logout) -> loginactivity. 3) user1 logging in again: loginactivity -> activity7 .. , user1 must naturally go activity7 last stack if possible. also user must see relevant him data. is there mechanisms manage stuff? mean, android platform support such multiuser apps, or restoring/storing stack manually. any other ideas? p.s. found workaround use sharedprefences each user store his data , store activity logged in from. seems not android way me. upd: done research, , found...

javascript - jQuery .load(): loading a div when click -

i achieve when clicking in image, in div image is, div other content .html loaded, can't done. if do, following, works perfectly: $('#windows_link').click(function(){ $('#apps_container').html("hi!"); }); but if following, not work; doesn't actually: $('#windows_link').click(function(){ $('#apps_container').load('windows_apps.html #apps_container'); }); any help, please? thanks lot in advance! when you're local other html path treated another domain in browsers (chrome on list). means ajax request (what .load() underneath) attempt blocked same origin policy . what have work fine...just not locally, in chrome. you can verify testing in browser firefox, or launching chrome with command line switch disable safety feature ( only testing!, turn off after): chrome.exe --disable-web-security

Generate XML from template and fill it with new data -

have xml (more 150 tags). need create additional 50 xml files based on template, tag values. have generated random data (saved in xls, csv, sql format) , need fill values in template , saved new name. how can this? (unix shell script, java, software, etc) thanks assuming able use sql server - check out xml http://msdn.microsoft.com/en-us/library/ms345137%28v=sql.90%29.aspx#forxml2k5_topic4

PHP & Oracle - oci_connect() ORA-12705: Cannot access NLS data files -

we've been using oracle on our server years, removed yesterday without clear warning , it's thrown our systems! i've acted on advice cwallenpoole (thank you!) , have made progress, , php @ least including oracle functions (ie oci_connect) experiencing error message: " warning: oci_connect() [function.oci-connect]: ora-12705: cannot access nls data files or invalid environment " we have ensured tnsnames.ora etc files in correct place, still having no joy :( thank you ok. personal nightmare. wake in middle of night... or don't, have spent days on problem. so, worked me: do have oracle instant client ? if not it. do have oracle sdk ? if not it. unzip instantclient. unzip sdk sub-directory add oracle_home exported command line variable ($oracle_home in *nix, %oracle_home% in win). have point fully-qualified path above instantclient folder. create oracle_bin , have point sdk. add oracle_home path. restart apache... so... do... , ...

xsd - Is this the proper way to added enumerated attributes to a complexType? -

is proper way set attribute enumerated values on complextype availstatusmessagetype . see lot of examples declare complexcontent section right below complextype declaration? complexcontent , necessary here? <xs:complextype name="availstatusmessagetype"> <xs:sequence> <xs:element name="lengthsofstay" type="lengthsofstaytype" /> <xs:element name="restrictionstatus" type="restrictionstatustype"/> </xs:sequence> <xs:attribute name="bookinglimit"> <xs:simpletype> <xs:restriction base="xs:string"> <xs:enumeration value="setlimit" /> <xs:enumeration value="adjustlimit"/> <xs:enumeration value="removelimit"/> </xs:restriction> </xs:simpletype> </xs:attribute> </xs:complextype> element types can divided 2 categories in xml schemas elements can conta...

Android MapView Initial Location -

my app starts detecting location launches when load mapactivity time later takes while before mylocationoverlay.runonfirstfix fired. am able somehow pass location have map when created? i find hard believe runonfirst fix taking long time run if have active location listener or had 1 should location pretty quickly: runonfirstfix : queues runnable executed have location fix. if have fix, we'll execute runnable , return true. if not, we'll hang on runnable , return false; location fix, we'll run in in new thread.

How can I register facebook users on my site ? -

i trying find walk through on how register users via facebook onto site. the facebook developers site keeps confusing me , hoping there easier tutorials follow. stephen, can little complicated. you have combine documentation at: http://developers.facebook.com/docs/guides/web/ http://developers.facebook.com/docs/plugins/registration/ boiling down simplest case: <html> <head> <title>my facebook registration page</title> </head> <body> <div id="fb-root"></div> <script src="http://connect.facebook.net/en_us/all.js"> </script> <script> fb.init({ appid:'yourappid', cookie:true, status:true, xfbml:true }); </script> <fb:registration fields="[{'name':'name'}, {'name':'email'}, {'name':'favorite_car','description':'what favorite car?', ...

SQL Server XML add attribute if non-existent -

i trying add attribute if not exist. should simple, new xml xpath/xquery/etc., excuse ignorance. i want able pass xml data , modify it... alter function [dbo].[convertxmldata](@xmldata xml) returns xml begin return @xmldata.<something here> end if pass data like: <something> sample data <xxx id="1"/> , <xxx id="2" runat="server" />. more <yyy id="3" /> </something> i <something> sample data <xxx id="1" runat="server" /> , <xxx id="2" runat="server" />. more <yyy id="3" /> </something> and not : <something> sample data <xxx id="1" runat="server" /> , <xxx id="2" runat="server" runat="server"/>. more <yyy id="3" /> </something> you can do set @xmldata.modify('insert attribute runat { "server" ...

Default C# String encoding -

i having issues default string encoding in c#. need read strings files/packets. however, these strings include characters 128-256 range (extended ascii), , of these characters show question marks , instead of proper character. example, when reading string ,it come "s?mestr?n?" if string contained extended ascii characters. now, there way change default encoding application? know in java define default character set command line. there's no 1 single "extended ascii" encoding. there lots of different 8-bit encodings compatible ascii bottom 128 values. you need find out encoding files actually use, , specific when reading data streamreader (or whatever else you're using). example, may want encoding windows-1252 : encoding encoding = encoding.getencoding(1252); .net strings always sequences of utf-16 code points. can't change that, , shouldn't try. (that's true in java well, , shouldn't use platform default encoding when ...

How can I pass a message from outside URL to my Chrome Extension? -

i know there's way extensions , pages communicate locally, need send message outside url, have chrome extension listen it. i have tried easyxdm in background page, seems stop listening after awhile, if google "turns off" javascript in background page after awhile. i think may try walk around , build site specific data structure, , implement content script specific specific data structure, , when finds 1 can fetch data want passed extension.

Couldn't run bat file through Java code -

problem same code below working on other machine windows 7. use windows 7, , bat file works well. if try run bat code written before, cmd window blink once , disappear. s = path + "makeinfomap.bat"; try { p = run.exec(s); } catch (exception e) { system.out.println(e); e.printstacktrace(); } final int exitval = p.waitfor(); run don't walk link: when runtime.exec() won't . it tell how gobble output , error streams , tell how call os's command interpreter when doing similar programs (although little out of date).

compiler construction - Learning C++: Example of Stack Underflow in C++ -

what can simple example in c++ causes stack-underflow in case of invoking , returning method calls. familiar calling convention, i.e thiscall, stdcall , cdecl , way clean stack. in specific, wouldn't stack underflow taken care code generated compiler automatically me ? what situations can me trouble stack-underflow ?? the way can see happening if declared function use stdcall (or other calling convention specifies callee clean stack) , invoke function through function pointer specified cdecl (or other calling convention stack cleaned caller). if that, called function pop stack before returning , caller pop stack leading underflow , terrible things. in specific case of member functions, calling convention referred thiscall , whether caller or callee cleans stack depends on compiler. see here details of calling conventions.

java - Prevent WebView from displaying "web page not available" -

i have app makes extensive use of webview. when user of app not have internet connection, page saying "web page not available" , various other text appears. there way not show generic text in webview? provide own error handling. private final activity activity = this; private class mywebviewclient extends webviewclient public void onreceivederror(webview view, int errorcode, string description, string failingurl) { // need this: activity.webview.wipeoutthepage(); activity.mycustomerrorhandling(); toast.maketext(activity, description, toast.length_long).show(); } } i found out webview->clearview doesn't clear view. first create own error page in html , put in assets folder, let's call myerrorpage.html onreceivederror: mwebview.setwebviewclient(new webviewclient() { public void onreceivederror(webview view, int errorcode, string description, string failingurl) { mwebview.loadurl("file:///android_asset/myerrorpage.html...

windows - Can xcopy transfer the files in a subdirectory, but not the directories themselves? -

essentially, want copy *.txt current directory subdirectories. if xcopy /s /e c:\source c:\dest , copies not files, directory structure well. need files copied, c:\dest contains nothing *.txt files. checked documentation both xcopy , robocopy, couldn't find parameters allowed functionality. how using loop? it'll execute lots of copy commands, give try: for /r c:\source %%f in (*.txt) xcopy /s "%%f" "c:\dest"

C++ cross platform build automation -

i have cross platform c++ project targets , compiles on linux, osx , windows. i'm using gnu make handle building on platforms, gcc compiling under linux & osx , cl.exe compile under cygwin on windows. current workflow consists of coding under osx , building on each individual platform test code portability. process time consuming , wondering if possible automatically build on platforms in 1 step? if understand op correctly, question isn't replacing make how launch build on each platform? i'd suggest using http://jenkins-ci.org/ - it's java , can run on windows, linux, osx, etc. can configured launch build jobs concurrently time want build each platform launched simultaneously. the learning curve jenkins isn't terrible take 3-4 hours working right, once it's smooth sailing. if want pro, can have poll source repo , it'll launch builds automatically after commits.

dynamic cast - Real world example of dynamic_cast in C++ -

can give me real world example of case when dynamic_cast needed , can't worked around @ all? examples can think of can worked around double dispatch. if constraint strong, example dynamic_cast way go nice. i'd see real examples instead of "it's used cast between types , down type tree". double dispatch requires types interacting have intimate knowledge of each other's innards, requires 1 class call methods on other class. dynamic_cast works when cannot modify innards of class, or not wish break encapsulation of classes in question. that is, double dispatch invasive on classes involved, while dynamic_cast works without knowledge of cast in classes. you can use dynamic_cast if don't know target method overload invoked. example, see this question posted yesterday . finally, double dispatch not come without it's own headaches the base class shape must know derived classes, resulting in circular dependencies. if derive new cla...

objective c - Recognition of swipe with two touches in UIScrollView -

i have uiscrollview full screen size (ipad, 1024x768, landscape mode). need recognize swipe 2 finger in direction on it. that's have (mainscroll property of class): //myviewcontroller.h - (void)loadview { mainscroll = [[uiscrollview alloc] initwithframe:cgrectmake(0, 0, 1024, 768)]; mainscroll.contentsize = cgsizemake(1024*pagenumber, 768); mainscroll.pagingenabled = yes; mainscroll.delegate = self; [self.view addsubview:mainscroll]; gesturerecognizer *tapinterceptor = [[gesturerecognizer alloc] init]; tapinterceptor.numberoftouchesrequired = 2; tapinterceptor.direction = uiswipegesturerecognizerdirectionup | uiswipegesturerecognizerdirectiondown | uiswipegesturerecognizerdirectionleft | uiswipegesturerecognizerdirectionright; [mainscroll addgesturerecognizer:tapinterceptor]; mainscroll.userinteractionenabled = yes; } and //gesturerecognizer.h - (void)touchesbegan:(nsset *)touches withevent:(uievent *)event { if ([to...

iphone - Memory Usage Test -

i trying see how real memory application using. application uses acceleometer input, when click "profile" in xcode 4 runs smoothly until application starts up. accelerometer doesn't work correctly. device supports landscape right , when tilt device ball moves up, if tilt other way ball doesn't move. when build , run game works perfectly. - (void)accelerometer:(uiaccelerometer *)accelerometer didaccelerate:(uiacceleration *)acceleration { #define kfilteringfactor 0.1f uiaccelerationvalue rollingx, rollingy; rollingx = (acceleration.x * kfilteringfactor) + (rollingx * (1.0 - kfilteringfactor)); rollingy = (acceleration.y * kfilteringfactor) + (rollingy * (1.0 - kfilteringfactor)); float accelx = acceleration.x - rollingx; float accely = acceleration.y - rollingy; b2vec2 gravity(-accely * 3, accelx * 3); _world->setgravity(gravity); } any ideas? also different, i'm using cocos2d build application , i've added ba...

xcode - How to change it back from activity indicator to disclosure in UITableViewCell after pushViewController -

how change activity indicator disclosure ?? the problem is: when didselectrow, made disclosure activity indicator because load picture next view controller , it's worked, dont have luck change disclosure after pushviewcontroller. tried reload table 2ndviewcontroller it's crashed. so have solution problem.. thanks in advance this code in didselectrow : -(void)threadstartanimating:(id)data { [activityview startanimating]; [self.navigationcontroller pushviewcontroller:bdvcontroller animated:yes]; } - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { uitableviewcell *cell = [tableview cellforrowatindexpath:indexpath]; activityview = [[uiactivityindicatorview alloc] initwithactivityindicatorstyle:uiactivityindicatorviewstylegray]; [cell setaccessoryview:activityview]; [nsthread detachnewthreadselector:@selector(threadstartanimating:) totarget:self withobject:nil]; // na...

iphone - Querying to an instance if it is already deallocated -

i know memory management rules , there no need of asking if follow these rules. but, wonder if there way know if instance deallocated without throwing exception. app uses object view on app can become delegate. sometimes, i'm getting known error. can avoid setting delegate nil on dealloc method of current delegate owner. in summary... have way know if object deallocated? thanks. can tell if pointer points garbage? no, not really. once object deallocated, memory can reused at time . it'll point garbage (causing crash), it'll point different obj-c object, , memory not have been reused yet. the main exception if set environment variable nszombieenabled=yes (in "edit scheme" somewhere in xcode 4), memory used objects never deallocated (unless set nsdeallocatezombies=yes , or so); instead, sending message zombie cause exception. it's useful debugging, largely because tells class name of instance got deallocated.