Posts

Showing posts from August, 2014

c# - Recycle Bin image displayed on message box -

writing winforms application. have created yes/no message box, displayed user when trying delete file add recycle bin image message. how access, use things message boxes systems icons/images? messagebox.show("please confirm delete folder named:" + fldnme, "confirm folder delete", messageboxbuttons.yesno, messageboxicon.exclamation); obviously replacing messageboxicon with? thanks short answer: cannot. the win32 messagebox window lets choose 1 of 4 icons (the other members of messageboxicon synonyms) corresponds purpose of messagebox: ask user confirmation question (a yes/no messagebox question-mark icon) to warn user (usually single button warning triangle icon) to inform user of information (usually single button "i" icon) to inform user of serious error (usually single button red stop icon) in use-case, ask user confirm deletion of file, should use

Google Map API for Android: TOS Reporting requirement -

i have android application using v1 version of maps api. i'm looking upgrade v2, in reading terms of service came across provision: 9.2 reporting. must implement reporting mechanisms google has set forth , may update time time in these terms , in maps apis documentation. example, specified in maps api documentation, agree provide reports google if maps api implementation enables device detect own location through use of sensor (including not limited gps, cell triangulation, wifi or similar functionality) display location of device on map or calculate route. i'm wondering if means there additional configuration or features need implement. know this question asked year ago iphone , answer "nothing" , couldn't find discussion anywhere on how applied android side, since (i believe) v1 api didn't require agree these terms. for record, faq on question (found here ) provides links guidance javascript, flash, , static api versions, not android. not s

image - Word that encompasses pixel and voxel -

is-there word generalizes notion of pixel , voxel dimension ? similarly, superpixel / supervoxel. referring "superpixel or supervoxel" method can operate on both isn't quite nice. if not tied dimension, , "voxel+time" or "supervoxel+time" etc. commonly accepted term ? look @ etymology: pixel = picture element, voxel = volume element. given picture 2d space , volume 3d space think best term "space element", or "spaxel". made on-the-spot. interestingly, after 5-second google search wiktionary supports definition: http://en.wiktionary.org/wiki/spaxel blend of space , pixel, introduced in 2012 paper spaxels, pixels in space: novel mode of spatial display (horst hörtner, matthew gardiner, roland haring, christopher lindinger, florian berger).

javascript - Spotify App Preview API Access model.player properties -

i've been playing around latest spotify preview api i'm having issues accessing player properties. im trying current track playing. test snippet below. require([ '$api/models', '$api/search#search', '$views/image#image' ], function(models,s, image) { 'use strict'; console.log(models.player.track) }); however undefined in console.log seen can access methods. please have @ link reference http://developer.spotify.com/technologies/apps/docs/preview/api/api-models-player.html found so before can access player properties must call load method require([ '$api/models', '$api/search#search', '$views/image#image' ], function(models,s, image) { 'use strict'; models.player.load('track').done(function(prop) { console.log(prop.track.name); }); });

sql - PostgreSQL partition query by date optimization -

we have table has approximately 1 billion records per month. considering 18 months of history talking 18 billion records. this table partitioned weekly date (so have around 74 partitions). for 1 of our queries need last 1000 records of 1 given unit. this select code, obs_time unit_position unit_id = 1 order obs_time desc limit 1000; the problem have following result in explain: limit (cost=96181.06..96181.09 rows=10 width=12) -> sort (cost=96181.06..102157.96 rows=2390760 width=12) sort key: unit_position .obs_time -> result (cost=0.00..44517.60 rows=2390760 width=12) -> append (cost=0.00..44517.60 rows=2390760 width=12) -> seq scan on unit_position (cost=0.00..42336.00 rows=2273600 width=12) -> seq scan on unit_position_week350 unit_position (cost=0.00..21.60 rows=1160 width=12) -> ... (all other partitions) ... -> seq scan on unit_position_week450 unit_position (cost=0.00..21.60 rows=1

java - How do you take inputted characters and output them a certain number of times? -

i have write program takes 2 inputted characters , print them out x times using method. have far, output numbers instead of characters. how can fix it? int length; char ch1; char ch2; system.out.print("enter character: "); ch1 = input.nextline().charat(0); //input refers scanner. system.out.print("enter second character: "); ch2 = input.nextline().charat(0); //input refers scanner. system.out.print("enter length of line: "); length = input.nextint(); //input refers how many times characters ar$ draw_line(length, ch1, ch2); //method starts here. public static void draw_line(int length, char ch1, char ch2){ (int = 0; < length; ++i){ system.out.print(ch1 + ch2); } } this because adding chars not concatenation. please see question: in java, result of addition of 2 chars int or char? what want string containing 2 chars, shortest edit is: system.out.print("" + ch1 + ch2);

styles - Font-weight not changing in css -

using google webfont, can't font-weight yield results. 3 weights have names aren't specified in href link i'm not sure if name needs added. here's portion of code: <link href='http://fonts.googleapis.com/css?family=quicksand:400,300,700' rel='stylesheet' type='text/css'><style type="text/css"> body{ background-color: white; margin-left: 20%; margin-right: 20%; border: none; padding: 10px 10px 10px 10px; font-family: quicksand, sans-serif; font-weight: 300; } i able working in fiddle leads me believe have font-weight overriding font-weight trying set. use either chrome or firefox's developer tools , can locate style overriding 1 trying set. keep in mind: more specific styles win (id vs class example) styles found later in style sheet override identical styles earlier in sheet.

javascript - auto play using flowplayer in ios devices -

is there way auto play videos using flow player in ios devices? have searched lot , couldn't find out anything. i have used below code display videos:` <source src="file2.mp4" type="video/mp4"> <object id="flash_fallback_1" class="vjs-flash-fallback" type="application/x-shockwave-flash" data="flowplayer-3.2.7.swf"> <param name="movie" value="flowplayer-3.2.7.swf"> <param name="allowfullscreen" value="true" /> <param name="flashvars" value="config={'clip':[{'url': 'file2.mp4','autoplay':true,'autobuffering':true}]}"> </object> </video>` sadly impossible on ios, user interaction required play video. on related note, audio cannot controlled via code either. source

debugging - Visual Studio - launch .bat file as startup project -

i have c++ program i'm trying debug. run .bat file file cleanup before running program. can run program script , attach debugger, more convenient launch .bat file vs. if set startup project's command property bat file error it's unrecognized binary format (because it's not binary format, suppose). can set command cmd.exe , command shell opens, haven't figured out how pass .bat file command shell. i've tried including on properties command line, , without redirection char (<), , tried passing argument command, neither of these work. i've gotten close enough think there must way this, i'm running out of ideas. i recommend instead of calling batch file @ end starting application, add post-build event in "build events" project settings. in post-build event type clean-up code, omit "program start" line. let vs run program. way not need attach program

Sending email to users in vb.net -

ok im trying send email user enters email textbox. got basic idea of whats should confused should put , cmtpclient(), credentials, , from. email should go there. tryed puting in email address , credentials keep getting error " smtp server requires sercure connection or client not autherticated". here code try dim username string username = textbox1.text dim smtpserver new smtpclient("smtp.gmail.com") dim mail new mailmessage() smtpserver.credentials = new system.net.networkcredential("what username goes here", "what password goes here") smtpserver.port = 587 mail = new mailmessage() mail.from = new mailaddress("what email should put here") mail.to.add(username) mail.subject = "qustions" mail.body = "this testing mother" smtpserver.send(mail) msgbox("mail send") catch ex exce

SQL Group by Child Table with conditions -

i have simplified bit ask question. run tables please. i have 2 tables parent table columns parentid,parent_firstname,parent_lastname child table columns are childid,child_firstname,child_lastname,parentid,parent_firstname,parent_lastname parent table has 1 record 1,joe,bloggs child table has 3 records 1,bob,lawrence,1,, 2,sam,hunt,null,joe,bloggs 3,sam,hunt,1,, i want able following using query joe bloggs bob lawrence joe bloggs sam hunt but.. want able link parent , child table following 1)if there parentid on child table link using parentid 2)else compare parent_first , parent_lastname in child table of child tables thanks in advance like this: select p.parent_firstname, p.parent_lastname, c.child_firstname, c.child_lastname parent p inner join child c on p.parentid = c.parentid; see in action here: sql fiddle demo . this give you: | parent_firstname | parent_lastname | child_firstname | child_lastname | ----------------

javascript - Trying to respond with text split into array of words from node.js http server -

new node.js, appreciate can offer. trying response out variable 'words' when start server , go localhost crashes , says " typeerror: first argument must string or buffer" when try write same variable console works. help! var http = require("http"); var fs = require('fs'); var text = fs.readfilesync("text.txt").tostring(); var words = text.split(/\b/); function start(){ function onrequest(request, response){ response.writehead(200, {"content-type": "text/plain"}); var wordcounts = ''; for(var = 0; < words.length; i++) wordcounts["_" + words[i]] = (wordcounts["_" + words[i]] || 0) + 1; response.write(words); response.end(); } http.createserver(onrequest).listen(8888); console.log("server has started"); } exports.start = start; i'd this: … var words = text.split(/\s+/); // hardly want split on every word boundary

Issue with fahrenheit conversion formula in C -

this question has answer here: why can't return double 2 ints being divided 8 answers why division result in 0 instead of decimal? 6 answers when writing program in c convert celsius fahrenheit, following formula gives incorrect output: int fahr = 9 / 5 * celsius + 32; now, understand issue 9/5 being interpreted integer, don't understand using double or float it still gives same incorrect output. oddly enough following formula gives correct output despite setting type int : int fahr = celsius / 5 * 9 + 32; furthermore, i've noticed simple below, when type set double , still gives output 1.0 instead of 1.8: double x = 9 / 5; printf("%lf\n", x); i've read thread: c program convert fahrenheit celsius but still don't understand

java - How do I turn the diagonal line to the other side? -

i have code it's printing diagonal this...i wanted go top right bottom left, idea how turn it? * * * * * code: class diagonal { public static void main(string args[]) { int row, col; string spaces = " "; for( row = 1; row < 6; row++) { system.out.println(spaces +"*"); spaces += " "; } } } you construct diagonal inserting space each additional row. therefore, if start number of rows , remove space should inversion. need clean how we're doing spaces can subtract number per row more easily. class diagonal{ public static void main(string args[]) { int row, col; for( row = 6; row > 0; row--) { (int x = 0; x < row; x++) { system.out.print(" "); } system.out.print("*\n");//note carriage return } } }

php - Best Technique to Store Password History for Users? -

i in process of developing php login system. implement restriction users cannot use password have used (up 5 old passwords). best option storing passwords? came 2 idea's: 1) table: password column: passwordid, userid, password1, password2, password3, password4, password5, lastchanged, currentpassword. each user have own row. fill columns on time , rewrite accordingly. or 2) table: password column: passwordid, userid, password, datechanged. each user have 6 rows. php handle figuring out of current via date. option 2 better of 2 options except don't have worry deleting rows. rdbmss have way of selecting top n records based on something. the major reason option 2 better, if either increase or decrease number of records have queried, can update database record.

c++ - malloc'd memory overlaps object created by std::make_shared -

a call malloc returning pointer block of memory overlaps memory allocated make_shared . i'm building fuse client, , malloc call in fuse library, i'm not sure that's relevant. wasn't able reproduce error outside program, , i've got no idea next. valgrind doesn't find errors until pointer in object managed shared_ptr corrupted , used. this bug result of creating shared_ptr new , typecasting weak_ptr , deleting it. have typecast because i'm using c library (fuse) , passing pointer weak_ptr , , provides uint64_t store handle. library calls functions , passes them struct containing pointer typecast uint64_t .

C# command not writing a line -

well hello, how make console write line? managed make run cmd.exe when u process it, doesnt write line. private void button1_click(object sender, eventargs e) { if (textbox1.text == "alpha") { progressbar1.value = 100; if (progressbar1.value == 100) { messagebox.show("welcome master!"); system.diagnostics.process.start(@"c:\windows\system32\cmd.exe"); console.writeline("hello!!!"); } } if want interact console process, need :- var p = new process { startinfo = { filename = "cmd.exe", useshellexecute = false, redirectstandardinput = true, redirectstandardoutput = true } }; p.start(); var w = p.standardinput; w.writeline("dir"); w.writeline("exit");

iphone - EXC_BAD_ACCESS (code=2, address=0x3) -

Image
hi getting following error code: exc_bad_access (code=2, address=0x3) when press play looped cfretain. i can't figure out what's problem this. xcode pointing @ line: [nsdictionary dictionarywithobjectsandkeys:[self getcorrectname:oldcontroller], @"viewcontroller", sec, @"duration", nil]; i checked both values of dictionary , seem check out. - (nsstring *)getcorrectname:(uiviewcontroller *)viewcontroller { if (viewcontroller.class == [uinavigationcontroller class]) { uiviewcontroller *vc = [viewcontroller.childviewcontrollers objectatindex:0]; return nsstringfromclass(vc.class); } else { return nsstringfromclass(viewcontroller.class); } } # pragma mark - uitabbarcontrollerdelegate - (bool)tabbarcontroller:(uitabbarcontroller *)tbcontroller shouldselectviewcontroller:(uiviewcontroller *)viewcontroller { // tracking controller clicked [[mixpanel sharedinstance] track:@"tab_clicked"

SQL Server: Strange execution plan -

i have etl code running on sql server 2008 standard. relatively small number of rows (~50,000) processed , loaded temp table. execute insert query copy on rows not present in larger table (~1,000,000+ rows). temp table contains same primary key , clustered index destination table. create table #newclaims(extractdate datetime, sitename nvarchar(50), sitecd nvarchar(50), contracttypecd nvarchar(50), claimratetype nvarchar(50), claimratetypecd nvarchar(50), claimstatus nvarchar(50), claimstatuscd nvarchar(50), creationdt datetime, statusdt datetime, claimid nvarchar(50), seqnum int, creationuserid nvarchar(50), specialclaimind nvarchar(50), jobseekerid nvarchar(50), invoicenum nvarchar(50), jobid nvarchar(50), jobrefid int, recoveryreason nvarchar(50), claimamount money, gstamount money, approvedamount money, claimcurrencyind nvarchar(50), employerid nvarchar(50), baseratetype nvarchar(50), baseratetypecd nvarchar(50) constraint pk_newclaims primary key clustered(claimid, claims

.htaccess - Htaccess redirect url with raw php url containing variables -

i'm using cms rewrites urls , have url this: http://www.domain.com/folder/?user=user1 i'm looking have rewrite to: index.php?r=search&term=$1 would work? rewriterule ^/?user=(.*) index.php?r=search&term=$1 [l] seems giving me trouble. suggestions? the query string not part of uri-path test in rule. @ query_string variable. you may try this: options +followsymlinks -multiviews rewriteengine on rewritebase / rewritecond %{query_string} user=([^/]+)/? [nc] rewriterule ^folder/? /index.php?r=search&term=%1 [l,nc]

c# - I want to return a sublist of object and Total size of the Original List -

i want return sublist of object , total size of original list. in case can use map . example :- map<integer,string> sample(){ list<string> list = new arraylist<string>(0); for(i=0;i<50;i++) list.add(i+""); list<string> sublist = list.sublist(0,10); integer totalsize = list.size(); map<integer,string> map = new hashmap<integer,list>(0); map.put(totalsize,sublist); return map; } otherwise can return 1 pojo object fro returning these information calling function. i need performance wise guidance on . you need map store sublist , size of original list 2 different keys, here code in java meet req... map<integer, string> sample() { map map = new hashmap(); list<string> list = new arraylist<string>(0); ( int = 0; < 50; i++) list.add(i + ""); list<string> sublist = list.sublist(0, 10); integer totalsize = list.size(); map.put("sublist",

c# - Simple Windows Forms data binding -

let's have string property in form (and form not implement inotifypropertychanged). i've created bindingsource , set datasource form. bind textbox string property on form (indirectly, using bindingsource). question 1: when change value in textbox @ runtime, why don't hit breakpoint in setter of string property? thought binding control string property allow updates in direction (gui -> member data) occur automatically question 2: how can trigger updates in other direction (member data -> gui) occur when other gui changes string property? don't want implement inotifypropertychanged interface , add notifypropertychanged setter. thought using bindingsource's resetbindings @ least trigger manually public partial class form1 : form { private string m_blah; public string blah { { return m_blah; } set { m_blah = value; } } public form1() { initializecomp

ibm mobilefirst - IBM Worklight - Limitations of Worklight Studio for Developers -

is there documented limitations of worklight studio developer? or differences between worklight studio developer , worklight studio provided after product purchase? @alastair pitts: ibm worklight studio plug-in eclipse ide, allows develop applications ibm worklight mobile application platform . the differences between ibm worklight developer/consumer/enterprise editions are: developer: developer edition licensed development use only, free download does not contain application authenticity feature consumer/enterprise: enterprise edition has pricing metrics aligned business-to-enterprise (b2e) purchasing patterns. consumer edition has pricing metrics aligned business-to-consumer (b2c) purchasing patterns. contains application authenticity feature

viewstate - EnableViewState="false" does not work and Why asp.net view sate automatically decoded and stored in browser -

i used asp.net text-box , set enableviewstate="false" then run code , enter sample texts , enforced post-back (which means click button )then textbox control retain value . what wrong in code ? how can disable view-state ? <asp:textbox id="textbox1" enableviewstate="false" runat="server"></asp:textbox> <asp:button id="button1" runat="server" text="button" onclick="button1_click" /> then have 1 doubt. why asp.net view sate automatically decoded , stored in browser. read articles article says it’s security purpose. the user gives her/his information , use particular browser , maintain browser why view sate encoded. reasons decode view state ? well regarding first question can confusing @ beginning. textbox classes implement ipostbackdatahandler interface. a nice explation can found here-- http://www.codeproject.com/articles/378180/view-state-for-textbox-a

javascript - Keyup function is not transferring data in the lower div -

keeping simple , short, code , want have text content text input field shown in div(showcontent)..although no jquery error flagging in firebug..but still not showing content in lower div, let me know doing wrong ? also let me know correct function type of functionality if keyup not appropriate handling this? <form> <input type="text" name="usertext" placeholder="enter text" id="usertext" /> </form> <div id="showcontent"></div> <script src="http://code.jquery.com/jquery-latest.js"></script> <script> jquery(document).ready(function(){ jquery('#usertext').keyup(function(){ var mytext = jquery('#usertext').text(); jquery('#showcontent').html(mytext); }); }); </script> i tried jquery('#usertext').on('keyup',function(){...}); no :( there proble in reading text input box use var mytext = jq

iphone - CTTelephonyCenterAddObserver Private API not receiving disconnected event when call is connected and duration of call is more than 5/6 sec -

i using cttelephonycenteraddobserver(ct, null, callback, null, null, cfnotificationsuspensionbehaviorhold); log phone calls. here code of call method static void callback(cfnotificationcenterref center, void *observer, cfstringref name, const void *object, cfdictionaryref userinfo) { nsstring *notifyname=(nsstring *)name; if ([notifyname isequaltostring:@"kctcallstatuschangenotification"]) { nsdictionary *info = (nsdictionary*)userinfo; nsstring *state=[[info objectforkey:@"kctcallstatus"] stringvalue]; nslog(@"call status changed = %@",state); if ([state isequaltostring:@"5"]){//disconnect nslog(@"unanswered:%@",state); } if ([state isequaltostring:@"3"]){//outgoing nslog(@"outgoing calls:%@",state); } if ([state isequaltostring:@"1"]){//connected //call connected }

java - How to sort two arrays according to one array's values -

public static void getsort(short[] time, string[] champs){ system.out.println("time champs\n"); for(int a= 0; < time.length; a++){ char fletter=champs[a].charat(0); if('b' == fletter){ arrays.sort(champs); system.out.println(time[a] + " " + champs[a]); } } for(int a= 0; < time.length; a++){ char fletter=champs[a].charat(0); if('c' == fletter){ arrays.sort(champs); system.out.println(time[a] + " " + champs[a]); } } } hi guys, i'm in need advice , on function. trying output , display inside arrays time , champs. what desire output have is: time----champs 2001 banana 2004 banana 2000 boat 2003 boat 2011 carrot 2013 carrot 2002 cucumber where time , champs displayed correctly being displayed alphabetically when use arrays.sort(champs); my output is: time----champs 2004 banana 2005

dependency injection - Managing DI for Couchbase client -

with ravendb piece of cake: public class dataaccessmodule : ninjectmodule { public override void load() { bind<idocumentstore>().tomethod( context => { var documentstore = new embeddabledocumentstore { datadirectory = @"~/app_data/database", useembeddedhttpserver = true }; return documentstore.initialize(); } ).insingletonscope(); bind<idocumentsession>().tomethod(context => context.kernel.get<idocumentstore>().opensession() ).inrequestscope(); } } how 1 manage dependency injection couchbase .net client ? according this page , under heading "instantiating client": in practice, it's expensive create clients. client incurs overhead creates connection pools , sets thread cluster configuration. therefore, best practice create single client instance, per buc

matlab - How to find normals to an edge in an image -

Image
i doing work related eye images. did edge detection it. edge curve , not continuous. have assume continuous , find normals curve. how find normals using matlab? you can see image below. i want find normals upper curve. hope clear enough. even though seems unintuitive, edge direction @ every pixel pretty estimate of normal. simplest solution, because doesn't involve curve fitting. in matlab, can find pixel-wise edge directions using sobel filter: [bw,thresh,gv,gh] = edge(i,'sobel'); edgedir = atan2(gv, gh); this gives edge directions angles in radians.

asp.net mvc 3 - How to establish Asynchronous Process in MVC3? -

i using mvc3 , entity framework. in project, have view , controller. view importing 1000 records excel database , works fine. my requirement is, while inserting large rows of data database need indicate status of importing rows , % of loading completed , need add background process( thread).. how achieve one? need on this. view code: @using (html.beginform("fimport", "import", formmethod.post, new { enctype = "multipart/form-data" })) { //here i'm inserting 1000 of records using table <input type="submit" value="start import" /></td> } controller code: [httppost] public actionresult fimport(formcollection collection) { } how that?

iphone - UILocalNotification is not getting cancelled -

i trying cancel scheduled notification , notification getting called when try cancel notification not getting cancelled . nsarray notification contains random values when there 1 scheduled notification. can me . want cancel notification particular bookid. update : -(uilocalnotification *)schedulenotification :(int)remedyid { nsstring *descriptionbody; nsinteger frequency; uilocalnotification *notif = [[uilocalnotification alloc] init]; nslog(@"%d",remedyid); descriptionbody =[[self remedydetailsforremedyid:remedyid] objectforkey:@"remedytxtdic"]; frequency = [[[self remedydetailsforremedyid:remedyid] objectforkey:@"remedyfrequency"]intvalue]; nsarray *notificationfiredates = [self firedatesforfrequency:frequency]; (nsdate *firedate in notificationfiredates) { notif.timezone = [nstimezone defaulttimezone];

javascript - Save a file to filesystem with chrome packaged app -

i have variable full of css attributes use create css file , save apps file directory. how go in chrome packaged app? you're not going answer. can't this, , if figured out way it, considered security hole chrome team close. part of design goals of packaged apps make entire application statically analyzable @ time it's uploaded web store. means when user making decision whether install app store, decision based on code (it contains these scripts, css, , these images, , asks these permissions) rather on whether trust developer or website. www.example.com might trustworthy today, tomorrow might sold new owner, or compromised. decision "do trust example.com?" hard. packaged apps make decision easier; in cases, "thing" you're trusting right there, right in front of you, in crx downloaded. if understand design goal, understand why design of packaged apps doesn't allow self-modifying code (which generic term want do). if code generate c

javascript - IE - entire page redirects if iframe src is set with bad URL -

the code below shows problem. creates simple iframe. on browsers besides ie if url set http:[4 slashes] test.com instead of http:[two slashes] test.com iframe show error. on ie parent page redirects error page. i'm using iframe in widget in other people's website , can cause lot of damage in case of error. question how can avoided if src url bad error remain in iframe , not cause entire page redirect. to check can copy code jsfiddle.net , run. popup = window.document.createelement('div'); popup_html="<div style='width:300px;height:300px; ' >"; popup_html+=" <iframe src='http:////www.test.com' width='300' height='300' frameborder='0' ></iframe>"; popup_html+=" </div>"; popup.innerhtml=popup_html; //cbar_popup.style.visibility='visible'; window.document.body.appendchild(popup); you try clean url , attempt popup stuff if url valid: var url = 'ht

rdf - SPARQL Tracker Could not run update, Property not found in the ontology -

tracker-sparql -qu "insert silent <urn:uuid:38f> { <urn:uuid:38f> nfo:filedataobject , nie:informationelement ;nie:isstoredas <urn:uuid:38f> ; nie:url 'file.mp3' ; nie:datasource <urn:nepomuk:datasource:840494f4edg> ;nie:deviceid '840494f4edg';nmm:audiotype 128 ; tracker:available true; nmm:musicpiece , nfo:audio; nie:title 'abandoner' .}" tracker-sparql -qu "insert {<urn:artist:38caadd1f13bf78a26aca0e7d42a8f58> nmm:artist ;nmm:artistname 'aesop'; ?f nmm:performer <urn:artist:38caadd1f13bf78a26aca0e7d42a8f58>; nmm:extensemble <urn:artist:38caadd1f13bf78a26aca0e7d42a8f58> } { ?f nie:url 'file.mp3'}" first insert returns done. second insert returns not run update, property 'urn:uuid:38f' not found in ontology. i cannot understand how link new artist existing music piece. you second sparql insert statement malformed: insert { <urn:artist:38caadd1f1

ruby - Performing mathematical operations on numbers within a string -

given string containing comma-separated numbers, possible perform mathematical operations on them? for example, how can take string "123,456,789" , extract numbers within it, , perform operations 123 + 456 or 456 - 123 ? since you're messing around, can use eval , gsub >> eval '123,456,789'.gsub(',', '*') # 44253432 >> eval '123,456,789'.gsub(',', '+') # 1368 >> eval '123,456,789'.gsub(',', '-') # -1122

Best Practice for Multidomain Rails Shop Setup -

i'm developing new rails app has multiple shops on different domains different content. best practice this? i'm thinking of running 1 app , serve multiple domains , set shop shop.find_by_domain(request.host) or that. or better have 1 rails app every domain? thanks in advance. have looked subdomains? here railscast : http://railscasts.com/episodes/221-subdomains-in-rails-3 and can use 37 signals 'pow' gem. don't need different rails apps rather multi-tenant application. check out shopify.com , big rails app different shop model.

c# - Alpha value not persisting while saving Bitmap -

good morning all, i making image steganography project college. while hiding data in image. writing "text length" int32 in pixel. int32 of 4 bytes. thought write in 4 bytes of alpha,red,green,blue, each color of 1 byte. save image in bmp format. used single stepping , data distributed , set in pixel. the problem arise when read pixel. r,g,b have value had set them. alpha 255 no matter set. code using distributing int32 4 bytes are byte r, g, b, a; int colorvalue = messagelength; int first = colorvalue & 255; //r contains bit 0-7 means least significant 8 bits r = (byte)first; colorvalue = colorvalue - first; int second = colorvalue & 65535; colorvalue = colorvalue - second; second = second >> 8; //g contains 8-15 g = (byte)second; int third = colorvalue & 16777215; colorvalue = colorvalue - third; third = third >> 16; //b contains 16-23 b = (byte)third; colorvalue = colorvalue >> 24; //a contains 24-31 = (byte)colorvalue; pixelcolo

asp.net - How to secure a file from anonymous and autenticated user in C# -

i want build media library system don't know how go securing files body want hack system.i don't want user use 1 particular link access files, want user can buy media have access particular file.if 1 "friend" access it, , give file url unauthorized person friend should not able access it. for example, if have following link, how go make person not have access it. https://a4.sphotos.ak.fbcdn.net/hphotos-ak-ash4/296040_2530953916384_1329592446_32898884_1499197273_n.jpg i know how can go implementing in asp.net mvc. follow following [link] ( http://www.wrox.com/wileycda/section/id-291916.html ) that. im sured helps.

mapreduce - How job client in hadoop compute inputSplits -

i trying insight of map reduce architecture. consulting http://answers.oreilly.com/topic/2141-how-mapreduce-works-with-hadoop/ article. have questions regarding component jobclient of mapreduce framework. questions is: how jobclient computes input splits on data? according stuff consulting , job client computes input splits on data located in input path on hdfs specified while running job. article says job client copies resources(jars , compued input splits) hdfs. here question, when input data in hdfs, why jobclient copies computed inputsplits hdfs. lets assume job client copies input splits hdfs, when job submitted job tracker , job tracker intailize job why retrieves input splits hdfs? apologies if question not clear. beginner. :) no jobclient not copy input splits hdfs. have quoted answer yourself: job client computes input splits on data located in input path on hdfs specified while running job. article says job client copies resources(jars , compute

php - codeigniter callback from private methods not working -

i doing form validation in codeigniter using form validation library , custom callbacks. public function insert_user() { if($this->input->post('submit')) { // load form validation library $this->load->library('form_validation'); // configurations $config = array( array( 'field' => 'username', 'label' => 'username', 'rules' => 'required|callback_username_check' ) ); $this->form_validation->set_rules($config); // .... continue .... } } when method public, working expected. public function username_check($username) { // stuffs here } when make method private, not working. private function username_check($username) { // stuffs here } why callbacks private methods not working? why need this? public methods in codeigniter controllers ac

html - setting the max height of an image to the browser windows height -

this repost because couldn't comment on answers earlier question since made question while not signed in. i'm trying prevent image ever becoming taller browser window viewer never has scroll down see rest of image. however, can't figure out how set max height of image browser windows height. so far have: <!doctype html> <html> <head> <meta charset="utf-8"> <title>test title</title> <link rel="stylesheet" href="http://flip.hr/css/bootstrap.min.css"> </head> <body> <div class="container"> <img src="dovelow.jpg" alt="dove"> </div><!-- .container --> </body> </html> or add class image: see fiddle

linux - failing pull dependencies cloudstack 4 with maven3 -

mvn -p deps [info] scanning projects... downloading: http://repo.maven.apache.org/maven2/org/apache/apache/11/apache-11.pom [error] build not read 1 project -> [help 1] [error] [error] project org.apache.cloudstack:cloudstack:4.0.1-incubating-snapshot (/usr/local/apache-cloudstack-4.0.1-incubating-src/pom.xml) has 1 error [error] non-resolvable parent pom: not transfer artifact org.apache:apache:pom:11 from/to central (http://repo.maven.apache.org/maven2): repo.maven.apache.org , 'parent.relativepath' points @ wrong local pom @ line 23, column 11: unknown host repo.maven.apache.org -> [help 2] [error] [error] see full stack trace of errors, re-run maven -e switch. [error] re-run maven using -x switch enable full debug logging. [error] [error] more information errors , possible solutions, please read can me? try maven instructions major releases after cloudstack 4.0.0-incubating : to compile a

sql - ORA-29024: Certificate validation failure -

i've followed following tutorials : create wallet , create acl and still getting ora-29024: certificate validation failure error. i'm trying query : utl_http.set_wallet('file:/home/oracle/wallet', 'password'); l_http_request := utl_http.begin_request('https://somedomain.co.il'); l_http_response := utl_http.get_response(l_http_request); now i've added acl : *.somedomain.co.il,somedomain.co.il and i've downloaded certificate der encoded, i've read somewhere 1 needed , didn't errors in proccess of generating wallet. any thoughts? i'm using oracle 11g in end problem when exported certificate choose der, in case should have used pcks # 7, won't likley work in cases guess depends on key. so guess if landed here try , play certificate files (be sure remove , re-add) , important, change sessions between tries know if worked or not because otherwise it'll keep giving error though should work.

.net - How to populate List using DataTable and For Each Loop? -

i'm trying populate list using datatable, have each loop checks every row , adds item list. code isn't working, keep getting error.. system.nullreferenceexception: {"object reference not set instance of object."} -data: {system.collections.listdictionaryinternal} -helplink: nothing -inner exception: nothing -targetsite: {system.collections.generic.list`1[system.string] getlistofusers()} this code... function getlistofusers() list(of string) 'dim integer = 0 dim lusernames list(of string) = nothing dim dt datatable = getdatatable(db_config, "select * tblusers") if dt.rows.count > 0 try each drowitem datarow in dt.rows 'i = + 1 'if isdbnull(dt.rows(0)("fldusername").tostring) = false ' lusernames.add(dt.rows(0)("fldusername").tostring) 'end if if drowitem.item("fldus

html - Indenting Labels and Checkboxes, with the checkbox outside the label and long labels -

unfortunately i'm stuck using old program generate forms, can fiddle css. program generates following html: <input type="checkbox" name="_qstrategy_qv03_cv02" id="_q2_c1" class="mrmultiple" style="" value="v02"> <label for="_q2_c1"> <span class="mrmultipletext" style="">defining finance operating model align , support execution of organisation’s broader strategy. finance operating model description of how finance function’s people, process , technology interacts internally , externally deliver products , services.</span> </label> the label long , wraps on next line, text on next line directly under checkbox. how can make wrapped text indented? float elements width specified them label{float:left;width: 75%;} input[type="checkbox"]{float:left;width:20px} see fiddle

yii - CGridView filter ajax update is not happening -

im using cgridview display records. filter not working in application. instead of ajax update complete page gets reloaded. want filter records using ajax call. here code. $this->widget('zii.widgets.grid.cgridview', array( 'id'=>'mage-grid', 'dataprovider'=>$model->search(), 'filter'=>$model, 'ajaxupdate'=>true, 'columns'=>array( 'entity_id', 'name', 'sku', 'type_id', 'price', //'status', array( 'name'=>'status', 'header'=>'status', 'filter'=>array('1'=>'enabled','2'=>'disabled'), 'value'=>'($data->status=="1")?(&quo

Delphi XE3 indy gmail smtp -

i have problem sending gmail smtp mail indy on delphi xe3 build (version 17.0.4770.56661) i can smooth send laptop other pc's give error "connection closed gracefully" i add idlogfile component on form , give me line recv 18.04.2013 11:17:20: 220 mx.google.com esmtp s47sm13947715eeg.8 - gsmtp<eol> sent 18.04.2013 11:17:20: ehlo s23-101<eol> recv 18.04.2013 11:17:20: 250-mx.google.com @ service, [195.175.87.xx]<eol>250-size 35882577<eol>250-8bitmime<eol>250-starttls<eol>250 enhancedstatuscodes<eol> sent 18.04.2013 11:17:20: starttls<eol> recv 18.04.2013 11:17:21: 220 2.0.0 ready start tls<eol> sent 18.04.2013 11:17:21: quit<eol> and use code on app idsmtp1.host:='smtp.gmail.com' ; idsmtp1.username:='umutscada@gmail.com'; idsmtp1.password:='xxxx'; idsmtp1.port:=587; idsmtp1.usetls:=utuseexplicittls; idssliohandlersocketopenssl1.ssloptions.mode := sslmclient

android - can not render online resources or simple text in canvas -

i have view want display resources online. create subclass of android.view.view , override dispatchdraw method: public class tview extends view { asynchttpclient client = new asynchttpclient(); private paint p = new paint(); public tview(context context) { super(context); } @override protected void dispatchdraw(final canvas canvas) { client.get("http://developer.android.com/assets/images/dac_logo.png", new binaryhttpresponsehandler() { @override public void onsuccess(byte[] arg0) { dorender(canvas, arg0); } }); super.dispatchdraw(canvas); } private void dorender(canvas c, byte[] data) { log.d("xx", "data length :" + data.length); c.drawtext("hello", 10, 10 + p.gettextsize(), p); bitmap bmp = bitmapfactory.decodebytearray(data, 0, data.length); bitmapdrawable bd = new bitmapdrawable(bmp);

scala - Play Framework Json Object mapping partial objects -

another play framework 2.1 question documentation techie me wrap head around. if have scala case class object represents something, server: case class server(name: string, ip: string, operatingsystem: enums.operatingsystem) implicit val serverreads = ((__ \ "name").read[string] , (__ \ "ip").read[string] , (__ \ "os").read[enums.operatingsystem])(server.apply _) implicit val serverwrite = ((__ \ "name").write[string] , (__ \ "ip").write[string] , (__ \ "os").write[enums.operatingsystem])(unlift(server.unapply)) i create json reads , writes , can process whole object, fine. but possible map partial objects? for example, if had server wasn't active may not have ip, know change option[string] , map none, isn't perfect example, if wanted simplify json model without changing underlying case class, can map values class fields, whilst leaving others @ default? thanks tom you create custom apply me

How to click on link element with specific text using watir? -

i'm not able click on text link 'add' using watir : page: <div id="divadd" style="float: right"> <a onclick="switchview('2')" style="color: #1b56a7; cursor: pointer;">add</a> </div> watir code: browser.link(:text =>"add").click exception: unable locate element, using {:tag_name=>["a"], :text=>"add"} please me how handle this? if page has lot of ajax , javascript going on, may have wait little bit client side code finish rendering page after has been loaded browser. try this browser.link(:text =>"add").when_present.click if not work, make sure item not in frame or something.. btw, if there more 1 link on page text 'add' may have specify container outside link lets identify link want. eg. browser.div(id: => "divadd").link.when_present.click if

android - How to change the position of menu items on actionbar -

Image
i'm developing 1 application in have add custom layout on actionbar. adding custom layout done, when i'm adding menu items on actionbar custom layout changes it's position right of actionbar center of actionbar. below image have achieved far. i want on actionbar. custom layout(yellow button) @ right part of actionbar , menu items in middle. adding code achieve custom layout using native android actionbar: @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); getactionbar().setdisplayhomeasupenabled(true); getactionbar().sethomebuttonenabled(true); actionbar = getactionbar(); actionbar.setdisplayshowtitleenabled(false); actionbar.setdisplayuselogoenabled(false); actionbar.setdisplayhomeasupenabled(false); actionbar.setdisplayshowcustomenabled(true); cview = getlayoutinflater().inflate(r.layout.header, null); actionbar.setcustomvie

php - Change date format (keep "variables") -

i'm trying change dateformat according country user using. currently i've come this: function format_date($date = '', $format=null) { if($date == "0000-00-00") return ""; $datetime = new datetime($date); if(!$format){ $ci =& get_instance(); switch($ci->session->userdata("country")){ case 3: $format = "d-m-y h:i:s"; break; default: $format = "y-m-d h:i:s"; break; } } return $datetime->format($format); } but if format of $date is: 2013-03-15 15:50:30 i want output be: 15-03-2013 15:50:30 and if format is: 2013-03-15 i want output be: 15-03-2013 instead of: 15-03-2013 00:00:00 if wanter argument format

git - npm uninstall doesn't really uninstall on azure -

i'm using windows azure. in local repository deleted db-mysql with npm uninstall db-mysql when try push repository gives error. know db-mysql not supported windows can't delete package. should do? remote: node.js application run default node.js version 0.6.20. remote: remote: > db-mysql@0.7.6 install c:\dwasfiles\sites\lpserver\virtualdirectory0\site\wwwroot\node_modules\db-mysql remote: > node-waf configure build remote: remote: 'node-waf' not recognized internal or external command, remote: operable program or batch file. remote: error has occurred during web site deployment. remote: npm err! db-mysql@0.7.6 install: `node-waf configure build` remote: npm err! `cmd "/c" "node-waf configure build"` failed 1 remote: npm err! remote: npm err! failed @ db-mysql@0.7.6 install script. remote: npm err! problem db-mysql package, remote: npm err! not npm itself. remote: npm err! tell author fails on system: remote: npm err! node-waf co

java me - Stop asking permission again and again in J2ME -

i using location api , httpconnection in j2me application keeps tracking updated location , showing image of google map, asking user permission repeatedly. how avoid ? the permission talking security permissions. remove these security permission message need sign mobile application certified authority verysign or thawte you need purchase licensing certificate site. once certificate ( valid of year , cost around 20k india rupee ) can sign many applications want. j2me architecture made protect, not run api without permission. high level api's create/read/delete file, make http request,location api etc must require application sign avoid security messages.

c - Sieve of Eratosthenes using a bit array -

i have bit array prime[] of unsigned int . wish implement sieve of eratosthenes using array, having each bit represent number n . is, given n , array element holds bit corresponds n prime[n/32] , specific bit in position n%32 . my testbitis0(int n) function returns 1 when number prime (if bit == 0), otherwise 0: return ( (prime[n/32] & (1 << (n%32) )) != 0); my setbit(int n) function sets bit 1 @ corresponding position: int = n/32; int pos = n%32; unsigned int flag = 1; flag = flag << pos; prime[i] = prime[i] | flag; the issue i'm having when call setbit multiples of prime number, don't think sets bit correctly. when call setbit multiples of prime number (such 4, 6, 8, etc. number 2) next time run line: if(testbitis0(i)) { ... } with i = 4/6/8/etc still return 1 when should return 0. can please check code make sure implementing correctly? thanks. this looks you're after. there's bit array , bit twiddling function

Disable Plotpoint legend on hover in Highcharts -

can tell me how disable legend pops when hover on plotpoint in highcharts? thanks you talking tooltip: http://api.highcharts.com/highcharts#tooltip you can set 'enabled':false

java - Session is closed while creating Criteria -

the following code throws sessionexception @ line creates criteria object: public user getuserbyusername(string username) { try { criterion criterion = restrictions.eq("username", username); criteria criteria = (criteria) getsession().createcriteria(user.class).add(criterion); return (user) criteria.uniqueresult(); } catch(nullpointerexception ex) { return new user(); } } my getsession() method follows: public session getsession() { if(session == null) { session = hibernateutil.getsessionfactory().getcurrentsession(); } return session; } i have injected hibernateutil bean class has getsession() method. following exception. org.hibernate.sessionexception: session closed! @ org.hibernate.internal.abstractsessionimpl.errorifclosed(abstractsessionimpl.java:129) @ org.hibernate.internal.sessionimpl.createcriteria(sessionimpl.java:15