Posts

Showing posts from April, 2014

gen server - Erlang gen_server implementation -

in code below, why module prime_server not loading? -module(prime_server). -behaviour(gen_server). -export([new_prime/1, start_link/0]). %% gen_server callbacks -export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, code_change/3]). start_link() -> gen_server:start_link({local, ?module}, ?module, [], []). new_prime(n) -> %% 20000 timeout (ms) gen_server:call(?module, {prime, n}, 20000). init([]) -> %% note must set trap_exit = true if %% want terminate/2 called when application %% stopped process_flag(trap_exit, true), io:format("~p starting~n" ,[?module]), {ok, 0}. handle_call({prime, k}, _from, n) -> {reply, make_new_prime(k), n+1}. handle_cast(_msg, n) -> {noreply, n}. handle_info(_info, n) -> {noreply, n}. terminate(_reason, _n) -> io:format("~p stopping~n" ,[?module]), ok. code_change(_oldvsn, n, _extra) -> {ok, n}. make_new_prime(k) -> ...

ios - Comparing Date and Time Object -

this question has answer here: how compare 2 nsdates: more recent? 13 answers i working method , not giving me proper output came know, way comparing date , time object wrong. googled not find relevant solution. want compare date , time object object. for example: if (dtcur >= dtstart && dtcur <= mydt) // 2014-03-24 11:30:00 >= 2014-03-24 11:00:00 & 2014-03-24 11:30:00 <= 2014-03-25 11:00:00 { // should come here in if condition } but goes in else. means comparison wrong, can me how compare 2 date , time objects. in advance many objects, including nsdate, have compare: method. use so: if ([date1 compare:date2] == nsorderedascending) { // date2 after date1 } else if ([date1 compare:date2] == nsordereddescending) { // date2 before date1 } else if ([date1 compare:date2] == nsorderedsame) { // they're both sa...

Jquery Group Radio selection -

i have radio buttons this <input name="show[1]" type="radio" value="1" /> show<br> <input name="show[1]" type="radio" value="0" /> hide<br> <input name="show[2]" type="radio" value="1" /> show<br> <input name="show[2]" type="radio" value="0" /> hide<br> ... ... ... <input name="show[n]" type="radio" value="1" /> show<br> <input name="show[n]" type="radio" value="0" /> hide<br> here length of n can varies. this part of form submit. in jquery want make sure 1 of radio button each group should selected. how can this try this: $(':radio').each(function() { nam = $(this).attr('name'); if (submitme && !$(':radio[name="'+nam+'"]:checked').length) { alert(nam...

performance - MongoDB Slow query by ID -

i migrated mongodb database windows server centos. version 2.4.9. noticed have slow retrieval of records _id field! ran repair database on weekend bu did not solve problem. have method retrieves records ids (with in operator) (using spring data mongodb 1.4.1.release): @override public map<string, record> findasmapids( final string[] ids, final componenttype... comps ) { if( null == ids || 0 == ids.length ) { return null; } map<string,record> result = new hashmap<string,record>(); final criteria cr = where("_id").in( idarrfunction.apply(ids) ); final query qry = new query( cr ); setfieldstoreturn( qry, comps ); long start = system.currenttimemillis(); list<record> ritems = gettemplate().find(qry, record.class); long end = system.currenttimemillis(); system.out.println( "findasmapids()::" + (end-start) ); for( record r: ritems ) { result.put( r.getid(), r ); } re...

c++ - Why does this explicit conversion operator work with g++ but not Visual Studio 2013? -

the following example contains 2 templated classes represent degrees , radians explicit conversion operator cast between them. compiles , runs g++ ( ideone link ) not visual studio 2013 visual c++ compiler nov 2013 ctp (ctp_nov2013) platform toolset. #include <iostream> static const double pi = 3.14159265358979323846; // forward declarations template< typename t > class radians; template< typename t > class degrees; template< typename t > class degrees { public: degrees(const t value) : value_(value) {} template< typename u > explicit operator u() const { return value_ * pi / 180.0; } t value() const { return value_; } private: t value_; }; template< typename t > class radians { public: radians(const t value) : value_(value) {} template< typename u > explicit operator u() const { ...

iphone - Kiosk App in iOS can we provide any identifer to that app to use from URL scheme. -

i wanted, give identifier app create kiosk mode in ios. i.e. make add home screen , has icon on home page browse further. is there way, can give identifier name link of app getting created can app access our native , can provide url scheme same. thanks. ios not give access of url schemas. can refer document url schemas selected application given : http://wiki.akosma.com/iphone_url_schemes#phone

http - POST method WEBDAV not run -

i had server install webdav , try webdav method method copy, delete, get, lock, mkcol, propfind, propatch run good. can create file , store data in server put method. don't know how in post. when post anydata exist file server return data of old file. , check in server file not change thing when try post new file return "the requested url - url of file - not found on server." when try post new file out full path, send folder want store file. hope server create file auto gen name of file , return name me. server return resource content in folder ( thing index.html ) i want know how implement post method, can create or repair file on webdav server. 1 can me ? in general, webdav servers not support post (more precisely: webdav specification doesn't mandate specific behavior post, servers vary in do).

javascript - Needed canvas blurring tool -

Image
i have drawing app fabric.js ( http://fabricjs.com/freedrawing/ ) want embed blurring tool photoshop ( http://www.demowolf.com/tutorials/demo.php?id=1503&series=85&format=html ) this blurring function not working fine when try change color going wrong can see screenshots below ... function boxblurcanvasrgba( id, top_x, top_y, width, height, radius, iterations ){ if ( isnan(radius) || radius < 1 ) return; radius |= 0; if ( isnan(iterations) ) iterations = 1; iterations |= 0; if ( iterations > 3 ) iterations = 3; if ( iterations < 1 ) iterations = 1; var canvas = document.getelementbyid( 'paper' ); var context = canvas.getcontext("2d"); var imagedata; try { try { imagedata = context.getimagedata( top_x, top_y, width, height ); } catch(e) { // note: part supposedly needed if want work local files // might okay remove whole try/catch block , use // imagedata = context.getimagedata( top_x, top_y, width, height ...

php - Yii2 gii crud error Class 'app\models\Yii' not found -

i installed yii2 advanced template, created model news , want create crud (with gii), when click 'preview' error. did not change else in advanced template. i'm using wamp php fatal error – yii\base\errorexception class 'app\models\yii' not found 1. in c:\wamp\www\advanced\backend\models\news.php @ line 44 2. in c:\wamp\www\advanced\vendor\yiisoft\yii2-gii\generators\crud\default\search.php – yii\gii\generators\crud\generator::generatesearchlabels() @ line 18 1314151617181920212223 $searchmodelclass = stringhelper::basename($generator->searchmodelclass); if ($modelclass === $searchmodelclass) { $modelalias = $modelclass . 'model'; } $rules = $generator->generatesearchrules(); $labels = $generator->generatesearchlabels(); $searchattributes = $generator->getsearchattributes(); $searchconditions = $generator->generatesearchconditions(); echo "<?php\n"; ?> 3. i...

c - reading back a float number -

i using microchip c18 , have function splits float in 4 respective bytes.and c18 follow little endianess a[0]=*(fptr); address 0 a[1]=*(fptr+1); 1 a[2]=*(fptr+2); 2 a[3]=*(fptr+3); 3 and writes in serial eeprom. if wanted read float variable. float read_float(void) { float f; unsigned char *fptr; fptr=&f; *(fptr)=eepromread(0); *(fptr+1)=eepromread(1); *(fptr+2)=eepromread(2); *(fptr+3)=eepromread(3); return(f); } will function return float variable?. i'm devoid of hardware , simulation tools right now. i trust i'm clear on question. edit: while doing so. compiler mismatch error occurs on assigning char float..how remove error? the cleanest way *(char*)(fptr+ i ) = eepromread( i ); . want offset initial pointer, cast pointer character, dereferenced. also, @ least compiler (gcc) balks @ first assignment. need more fptr = (char*)(&f); pointer f...

javascript - jQuery click runs one time -

i working on jquery gallery thumbnails , have 2 arrows "scroll" through these thumbnails. first tried click event animation runs 1 time then. i have searched internet , found .on( 'click' ) event. tried no result. using .off( 'click' ) remove event after. can me this? $("#top_slide_button").on( 'click', function () { $("#slide_frame").animate( { marginbottom: -50 }, 200); $("#top_slide_button").off( 'click' ); }); $("#bottom_slide_button").on( 'click', function () { $("#slide_frame").animate( { margintop: -50 }, 200); $("#bottom_slide_button").off( 'click' ); }); you can try this: $("#top_slide_button").off( 'click' ).on( 'click', function () { $("#slide_frame").animate( { marginbottom: -50 }, 200); }); $("#bottom_slide_button").off( 'click' ).on( 'click', function...

javascript - Select second to last element -

i need select value of second last input selectable element: <tr><td><select class="x">...</select></td></tr> <tr><td><select class="x">...</select></td></tr> <tr><td><select class="x">...</select></td></tr> the select input tag inside tr tags. if use $("select.x").last() , jquery select last element. need select second last. you can use .prev() $("select.x").last().prev();

iphone - add a ContactBitMask to an object layer in a tmx map created in tiled? -

me , friend have started creating platform game using sprite kit in xcode . creating levels using program tiled consists of main layer , objects layer. having issues adding contact bit mask object layer in map. want player able make contact our objects such crates, floors, coins, health kits etc. any on how appreciated. you can use sprite kit's physics engine handle objects interacting each other. that's called collision detection. se link more information, it's in more general overview apple source code sample game "adventure". https://developer.apple.com/library/ios/documentation/graphicsanimation/conceptual/codeexplainedadventure/handlingcollisions/handlingcollisions.html you might using sk physics, here's more specific rundown. http://www.techotopia.com/index.php/an_ios_7_sprite_kit_collision_handling_tutorial good luck!

javascript - How to validate a domain exists from the browser? -

This summary is not available. Please click here to view the post.

Not able to integrate MoPub Banner Code to my Android application -

i using below link reference integrating mopub banner code android application: https://app.mopub.com/inventory/adunit/9e96b9fc658144c7a6abd0407ed21187/generate/?status=welcome i have done first steps , having problem step 2 ( android banner code integration ) i have included: <com.mopub.mobileads.mopubview android:id="@+id/adview" android:layout_width="fill_parent" android:layout_height="50dp" /> in layout below: <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/background_activated"> <checkbox android:id="@+id/crime_list_item_solvedcheckbox" android:layout_width="wrap_content" android:layout_height="wrap_content" android...

wpf - Find the focused cell from a DataGrid -

i need implement "copy value clipboard" function wpf datagrid should available through common channels: right-click context menu item; menu-key context menu item; ctrl+c hotkey. data grid content comes data binding, since copy command view-only thing, it's implemented in view layer, not viewmodel. don't use icommand event handlers in code behind. the datagrid's selectionunit set fullrow, arrow navigation keys still work , focus rectangle can seen single cells. single cell can focused while full row selected. command need determine focused cell. the menu item pretty complicated. click event gives me menuitem instance, can navigate contextmenu , further datagrid. that's all, no clicked-on cell. know how datagrid, there's 1 of them visible @ time. i need find out cell focused. can't list of selected cells or rows or rows. properties can find point fragments of information, , datagrid.rows doesn't exist. scan entire visual tree focused datagr...

Compare DATETIME with time() in php and mysql -

i check how many users online on moment on single query. thing have time kept datetime (in online field) , compare time() . here code: $online_margin = 10; //in minutes; $online_margin = $online_margin*60; $difference = time() - $online_margin; $query = "select id users online > $difference"; i've tried using convert() , cast failed, i'd appreciate on why... you need convert y-m-d h:i:s format before comparing db field, $online_margin = 10; //in minutes; $online_margin = $online_margin*60; $difference = time() - $online_margin; $difference = date("y-m-d h:i:s",$difference); //convert seconds y-m-d h:i:s format $query = "select id users online > $difference"; alternative: can convert column online unix_time comparing, $query = "select id users unix_timestamp(online) > $difference";

asp.net - Google map display in an iframe working in localhost but not on servers -

Image
i have iframe displays google map. has been working seems new update google causing me troubles. this how displayed in localhost and looks on both test , production servers my code : <iframe width="925" height="750" src="https://maps.google.fr/maps?q=4+place+richeb%c3%a9+lille&hl=fr&ie=utf8&sll=46.22475,2.0517&sspn=25.428258,56.90918&hnear=4+place+richeb%c3%a9,+59000+lille&t=m&z=16&output=embed" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"> and we've cleared browser cache , restarted service corresponding iis server on remote server. does have clue what's causing problem? thanks lot has observed kind of problem ? all included css files same, looks same in code side, not in result :/

vbscript - How to identify frame objects in web page of safari browser by testcomplete -

Image
i trying use safari(5.1.7) work web applications in testcomplete(10.10), have installed safari extension also. want cross browser testing in testcomplete,i using vb scripting language, using dom object model working web applications, able identify frame objects in firefox , internet explorer unable identify objects in frame of web page in safari browser,can please suggest me how identify frame objects in webpage in safari browser testcomplete, there patch needed identifying objects in safari browser through tetscomplete?please me....thanks in advance

SIP/2.0 481 Call Leg/Transaction Does Not Exit (UCMA) -

i create mspl transfer reroute calls ucma application endpoint below code mspl <?xml version="1.0" ?> <lc:applicationmanifest appuri="http://"domain name"/altrgs" xmlns:lc="http://schemas.microsoft.com/lcs/2006/05"> <lc:allowregistrationbeforeuserservices action="true" /> <lc:requestfilter methodnames="invite" strictroute="false" registrargenerated="true" domainsupported="true" /> <lc:responsefilter reasoncodes="none" /> <lc:proxybydefault action="true" /> <lc:scriptonly /> <lc:splscript><![cdata[ fromuri = geturi( siprequest.from ); fromuser = concatenate( getusername( fromuri ) ); touri = geturi( siprequest.to ); touserathost = concatenate( getusername( touri ), "@", gethostname( touri ) ); foreach ( sessionexpires in getheadervalues( "session-expires" ) ) { if ( containsstring...

java - How to determine if position Z is within regions with start X and end Y -

i have jtextarea user can create regions using special syntax. looking assistance in best way (most efficient using linear time algorithm) determine if current position within 1 of non-overlapping regions. let's assume have following determine user defined regions (i scan document @ start using regex determine regions): region start = 0, end = 20 region start = 21, end = 24 region start = 34, end = 40 i don't care region user in, need determine if in or out of region, given position x. store regions array , loop through entries until find 1 matches, isn't linear time , take longer if didn't match region. is there easier way using algorithm or storing data in way? actually algorithm proposing indeed linear. here one, bit more complicated, faster: you need use cumulative table data structure, binary indexed tree (bit). bit allows implement following operations logarithmic complexity: update lo, hi, val: add @ indices [lo, hi] value val query x: ...

oracle - How to find the root table for child table? -

how find root table child tables ? for example : - have 26 tables a,b,c ...z. need find indirect relation particular table b has relation c has relation b if give table_name c, come a(indirect relation) you can try , use hierarchical query on user_constraints pk constraint_type = 'p' fk constraint_type = 'r' , linked primary key r_constraint_name something along lines might work ( not tested ) select table_name user_constraints start table_name = 'x' , constraint_type = 'p' connect r_constraint_name = prior constraint_name , prior constraint_type = 'r'

model view controller - Extjs multiple instances of treepanel respond to same expand() -

i have rather strange issue contend today... essentially, have created custom component contains treepanel. within main application, user can create number of these components within different tabs of tabpanel. if expand node on 1 instance of component, expanded on instances (and subsequently created instances). other click listeners, etc remain unique each instance. i have checked out extjs source code, , don't see offending in there. thought have been clashing itemid, after randomising them, issue still there. perhaps it's them sharing store? i can include code in post, don't know how use be. it seems put object-specific settings class prototype instead of config passed object. it's guess if it's right, 1 should set items , other fields in initcomponent, not directly in object passed ext.define. anyway, show code, please.

gruntjs - grunt-sass: getting compilation errors to output to browser -

i have following setup in grunt.js: module.exports = function(grunt) { grunt.initconfig({ sass: { dist: { // target files: { 'public/stylesheets/css/application.css' : 'public/stylesheets/scss/application.scss' }, options: { outputstyle: 'nested', sourcecomments: 'normal', includepaths: [ 'public/stylesheets/scss/' ] } } } , watch: { sass: { files: ['public/stylesheets/scss/*.*'], tasks: ['sass:dist'] }, livereload: { files: ['public/stylesheets/css/*.*'], options: { livereload: 1234 } } } // task }); ...

How to perform forEach loop in Java -

i javascript developer , starting check out java. one question have how can perform foreach on collection. can't seem find such method in java collections... since java 5, can use enhanced for loop this. assume have (say) list<thingy> in variable thingies . enhanced for loop looks this: for (thingy t : thingies) { // ... } as of java 8, there's actual foreach method on iterables accepts lambda function : thingies.foreach((thingy t) -> { /* ...your code here... */ }); if have existing method want use, can use method reference instead of inline lambda: thingies.foreach(this::somemethod); // instance method on `this` thingies.foreach(someclass::somemethod); // static method on `someclass` thingies.foreach(foo::somemethod); // instance method on `foo` instance

php - PHPUnit with Symfony Fatal error: Class 'Doctrine\Bundle\DoctrineBundle\DoctrineBundle' not found -

i'm trying testing app made symfony. wrote test , when launch it, following error: fatal error: class 'doctrine\bundle\doctrinebundle\doctrinebundle' not found in /.../app/appkernel.php on line 17 i had same error symfony's monologbundle , asseticbundle , swiftmailerbundle : i've manually added these bundles app, pheraps have fixed errors, doctrine i've not found solutions yet. it looks maybe did not install doctrine bundle. try go root of project composer.phar located through console, , try run this: php composer.phar it install dependencies of symfony2,and going work :)

typoscript - In TYPO3 6.1, how to use header_layout from standard language only? -

i use header_layout field wrap content elements css classes. tt_content.text.stdwrap.outerwrap.cobject=case tt_content.text.stdwrap.outerwrap.cobject{ key.field = header_layout default=text default.value=| 1=text 1.value=<aside class="box clearfix">|</aside> } now, selection applied in default language, not in localisations. how tell typo3 @ header_layout field standard language (0), , how consequently hide field in localisations? and: use of header_layout often-practiced workaround, obviously. there field designed use (assigning custom ts individual content elements) in typo3 >= 6.0? to wrap content element other html default can use frames , indention dropdown of appearance tab. you add entry via pagetsconfig: tceform.tt_content{ section_frame { additems { 100 = new frame } } } and define corresponding rendering in typoscript: tt_content.stdwrap.innerwrap.cobject = case tt...

ios - Animated SVG in UIView -

i need play different animated svg files in uiview. example, this . is possible, , can tell me how it? update with pocketsvg i'm trying (thanks @dhanashree): - (void)viewdidload { [super viewdidload]; cgpathref mypath = [pocketsvg pathfromsvgfileaturl:[nsurl urlwithstring:@"http://www.hypnobeast.com/spirals/hypno_beast_spiral_1000x1000.svg"]]; cashapelayer *myshapelayer = [cashapelayer layer]; myshapelayer.path = mypath; [self.view.layer addsublayer:myshapelayer]; } but doesn't work. animated part of svg doesn't appear. pocketsvg allow display , manipulate lines of svg file. pocketsvg *mybezier = [[pocketsvg alloc] initfromsvgfilenamed:@"beziercurve1-ipad"]; uibezierpath *mypath = mybezier.bezier; cashapelayer *myshapelayer = [cashapelayer layer]; myshapelayer.path = mypath.cgpath; [self.view.layer addsublayer:myshapelayer];

java - Count number of button clicks in given time -

jbutton btnnewbutton = new jbutton("click me!"); btnnewbutton.setbounds(134, 142, 274, 77); btnnewbutton.addactionlistener(new actionlistener(){ public void actionperformed(actionevent e) { clicked++; string x=integer.tostring(clicked); textarea.settext(x); } }); i'm stuck here want create program in gui counts number of button click in specific time example timer start count number of clicks when loop stop button click not working or stop counting clicks there 2 possible solution 1.make button clickable when timer starts , unclickable when timer stops or 2.also u can use flag check whether timer running or not.if timer running make flag true when gets on make false. somthing below snipet public void actionperformed(actionevent e) { if (flag) { clicked++; string x=integer.tostring(clicked); textarea.settext(x); ...

php - $wpdb->insert is not respacting unique fields -

i have been creating wordpress plugin while. example of mysql table: $sql = "create table if not exists $table_name ( id int(11) not null auto_increment, email varchar(100) default null, telephone varchar(15) default null, primary key(id), unique (email, telephone) ) engine=innodb default charset=utf8 comment='wp plugin sesa_players db' auto_increment=1 ; "; email should unique, right? phpmyadmin says it. this wordpress code inserts data table: $err = $wpdb->insert($wpdb->prefix.$table_name, $data, $format); var_dump($err); it works, more should. assume email m@m.com. first insert goes well. second try fails because of duplicate entry should. var_dump false. if refresh wp page, third try same email passes flawlessly, var_dump 1. repeated wp refresh opens db duplicate entry. why? doing wrong? no, email not unique here. pair of email , telephone unique in table definition. $sql = "create table i...

iphone - Add multiple Push notifications to Global Array ios -

i have problem handling more 1 push notifications. when unlock iphone , there (for example) 10 push notifications of app, app register some: - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions: (nsdictionary *)launchoptions { if (launchoptions != nil) { nsdictionary *dictionary = [launchoptions objectforkey:uiapplicationlaunchoptionsremotenotificationkey]; if (dictionary != nil) { nslog(@"launched push notification: %@", dictionary); [self addmessagefromremotenotification:dictionary updateui:yes]; } } } if app open there no problem , received notifications added array. thank you

How to compare two fields and then set boolean in Microsoft Access? -

this current query: select i.itemno, nz(totalordered,0) sumofqtyordered, nz(totalreturned,0) sumofqtyreturn, nz(totalissued,0) sumofqtyissued, (nz(totalordered,0)-nz(totalissued,0)-nz(totalreturned,0)) balance ((item left join (select itemno, sum(qtyordered) totalordered delivered_item group itemno) d on d.itemno=i.itemno) left join (select itemno, sum(qtyreturn) totalreturned item_return group itemno) r on r.itemno=i.itemno) left join (select itemno, sum(qtyissued) totalissued item_issued group itemno) iss on iss.itemno=i.itemno; how compare field(minqty) in item table balance in query? , add 1 more field ,placeorder(boolean) in query. set yes when balance less minqty , no when above or equal minqty? 1 can code? add select : ((nz(totalordered,0)-nz(totalissued,0)-nz(totalreturned,0))<[minqty]) placeorder it return -1 (true) or 0 (false). if want return 'yes' or 'no': iif((nz(totalordered,0)-nz(totalissued,0)-nz(totalreturned,0))<[min...

Checking for internet connectivity after the app is installed Android -

i want design application in such way when app installed in device should first check if app connected internet or not before displaying layout. goin approach below. @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); connectivity = new connectiondetector(getapplicationcontext()); alertdialog = new alertdialogmanager(); //checking internet connection if(!connectivity.isconnectingtointernet()){ alertdialog.showalertdialog(getapplicationcontext(), "internet connection error", "not connected internet", false); return ; } else{ setcontentview(r.layout.activity_register); me = (edittext) findviewbyid(r.id.fname); email = (edittext) findviewbyid(r.id.email); age = (edittext) findviewbyid(r.id.age); address = (edittext) findviewbyid(r.id.address); state = (edittext) findviewbyid(r.id.state); country = (edittext) ...

android - Alternative drawable resources for my app. Scaling down XHDPI -

i have made design android app specially xhdpi devices. want support screen densities ldpi , highier. okay scale xhdpi design down in photoshop , each density? or need make design scratch every density maintain quality? scaling down absolutely ok. there're many scripts photoshop you. instance cutandslice

android - Root shell but not Root permission -

i have tablet approx apptb104b reference: http://approx.es/apptb104b#.uzart85mzrm when use adb shell access root, technically device comes rooted default. use adb konnect link: https://play.google.com/store/apps/details?id=com.rockolabs.adbkonnect which requires root access , works well, applications detect device isn't rooted. shows root checker app root checker screenshot http://imgur.com/zpfz2qi here build info, board don't fit in screenshot, it's value 'wing' build info http://imgur.com/fkpkwlj any ideas? update write here answer, in case didn't see comments. @chrisstratton said, having root access , letting apps things root 2 different things

sql server - How to delete a row with primary key id? -

i have sql table user. has 3 columns id(set primary , identity yes), name , password. when enter data table id became incremented. on delete query name , password deleted. need delete particular row including id. example: id:1 name:abc password:123 id:2 name:wer password:234 id:3 name:lkj password:222 id:4 name:new password:999 i need delete third column ie, id:3 name:lkj password:222 . after deleting row, table should shown below. id:1 name:abc password:123 id:2 name:wer password:234 id:3 name:new password:999 from additional information have provided shows not understand identity data type. others, including myself, have said numbers not re-used. you should avoid changing primary keys because row deleted. it seem need row number, don't use key this. create view using row_number function, like select row_number() on (order id) row_number, name, password, ... [your_table]

Unable to Update Sqlite Database in Windows Phone Application -

in windows phone application, using sqlite database. able retrieve data "read only" exception while trying add/update data. using below code public async void updatefavquote(int quoteid, string option) { var connection = new sqliteasyncconnection(_dbpath); if (option == "add") { await connection.executeasync("update quotes set isfav = 1 _id =" + quoteid); } else { await connection.executeasync("update quotes set isfav = 0 _id =" + quoteid); } } when run application on emulator/device, works fine, once app gets published store, start getting error. tried using below code gives same error public void updatefavquote(int quoteid, string option) { var connection = new sqliteconnection(_dbpath, sqliteopenflags.readwrite); if (option == "add") {...

Python Regex problems finding Caret ('^') -

i have problem regex in python 3.2 i want make sure string matches critera letter (or number) symbol. answer = bool(re.findall('[a-z|1-9][^a-z|1-9]',string)) this works expected. if test a# true , works types of enteries. accept when such t^ returns false . same no matter letter comes before caret. problem regex or python? there answers here none have picked in ^ used in character class, means not of these things , [^a] letter a. saying `"none of things after ^ , before nearest not-escaped ]" as mentioned or thing ... character class 1 big or! [\^a] matches ^ or a. careful though, backslash taken "the letter backslash" unless escapes something, example \k backslash , k, \n newline, \\n backslash (the letter) n. php not nice. need "\\\\" letter backslash, given thing after backslash can escaped (which regex engine works out), php not use "oh can't escape k, must therefore mean letter backslash followed k...

eclipse rcp - The standard 'Select all' command doesn't work -

i have tableviewer within view , use org.eclipse.ui.edit.selectall command select rows using standard ctrl+a shortcut. when put tracing on can see handlerauthority class resolves conflicts , output looks this: handlers >>> command('org.eclipse.ui.edit.selectall') has changed 'org.eclipse.ui.internal.handlers.selectallhandler' handler handlers >>> resolveconflicts: eval: handleractivation(commandid=org.eclipse.ui.edit.selectall, handler=org.eclipse.ui.internal.handlers.selectallhandler@2a3e58, expression=,sourcepriority=0) handlers >>> resolved conflict detected. following activation won: handlers >>> handleractivation(commandid=org.eclipse.ui.edit.selectall, handler=org.eclipse.ui.internal.handlers.selectallhandler@2a3e58, expression=,sourcepriority=0) handlers >>> resolveconflicts: eval: handleractivation(commandid=org.eclipse.ui.edit.selectall, handler=org.eclipse.ui.internal.handl...

Delphi IDE - MainForm shrinks when I click on any control -

delphi 2010, windows 8.1 64 bit. having oddity occur. when in ide, have form displayed. every time click on control in form, form's height , width shrinks. there not empty space @ bottom of form; controls (both visible , non-visible) being hidden. happens on multiple projects. has seen before? new install (about 2 weeks ago). non-standard functionality have have both gexperts 1.3.6 installed, cnpack ide wizards 1.0.2.666. i not behavior when running application. i have tried turning on 'lock controls' , made no difference.

How to insert custom HTML in theme via custom Shopify App? -

i want include custom html in shopify theme whenever user install / enable app in store. can suggest me how ? using asset api can add or update assets, example custom html. asset belongs theme, need theme api , gives access installed theme(s) , it's role(s). shouldn't update existing assets don't belong own app. if want add javascript store, might want use scripttag . a third option use application proxies . application proxies forward web requests application. application returns custom html (or liquid), returned visitor. way extend store example image gallery. keep in mind assets won't removed when store uninstalls app. after uninstall don't have access assets anymore. scripttag removed when store uninstalls app. application proxy can implement access mechanism , deny access when store uninstalls app.

c# - Naming collision with EntityFramework -

i using ef access sql db. sake of example lets assume have users table, user comments table (comments made users) , liked comments table (comments user marked on them) when context generated in user.cs file following icollections: public virtual icollection<comment> comments { get; set; } public virtual icollection<comment> comments1 { get; set; } how can know which? why ef not add foreign key table name column? i have several of these issues. in edmx designer, click on navigation property ("comments" or "comments1") , press f4 show it's properties. properties panel display foreign key name give enough info identify which.

ftp shell script breaks up after the lcd-command -

i created shell script download several files, starting "2014" ftp server. use mget , filename 2014* . make sure files saved @ right local place use lcd before. it looks this: #!/bin/sh host='ftpserver.name.de' user='user1' passwd='pw1' file='2014*' locdir='/home/local/data2014/' ftp -n $host <<end_script quote user $user quote pass $passwd lcd $locdir mget $file quit end_script exit 0 when try this, script runs: lx9000: ftp_get.sh connected ftpserver.name.de. 220 ftp-server: ftpserver.name.de 331 password required user1 230 user user1 logged in local directory now: /home/local/data2014/ 221 goodbye. why dose stop before downloading proceeds? thanks help! try adding: prompt off before mget .

node.js - Key exists error while using ADD into Couchbase -

i'm using couchbase nosql db guess can happen nosql db. here's happens: i'm checking if specific key exists , i'm catching keynotfound error add key database. see code: // retrieve document connection_id db.get(connection_id, function(err, result) { if (err && err.code === 13) { // catched keynotfound -> define new document voice connection var voice_c = { voice_count: '1', voice_duration: call_duration, last_contact: call_start }; // add new voice_c document connection_id db db.add(connection_id, voice_c, function(err, result) { if (err) throw err; // whilst adding new voice connection }); when db.add step error "key exists (with different cas value)" though checked fragments of millisecond before if same key exist (and didn't exist). i couldn't replicate error @ same place in data feed second time happened earlier, indicating it's random event. i'm puzzled how can happe...

jquery - Add incremental data attr value based on class name -

i have <li> s class names follows; <li class="2014" data-order=""></li> <li class="2014" data-order=""></li> <li class="2013" data-order=""></li> <li class="2013" data-order=""></li> <li class="2013" data-order=""></li> <li class="2012" data-order=""></li> i need jquery function add values each every <li> element's data-order. value has set follows. <li class="2014" data-order="1"></li> <li class="2014" data-order="2"></li> <li class="2013" data-order="1"></li> <li class="2013" data-order="2"></li> <li class="2013" data-order="3"></li> <li class="2012" data-order="1"></li> <li c...

Area under the curve of a contour plot created with matplotlib -

i have used matplotlib create contour plot. code simple , reads follows: import matplotlib.pyplot plt plt.contour(result_array, levels=[0,10,20],colors = ('white','red','black',)) plt.show() at point, measure area under curve of each line created contour plot. option between integrate, simps, trapz in principle work. issue unable extract numerical values of contour plot , not sure spacing is. tip?

java - Debug eclipse breakpoints disable for some classes -

currently debugging code , not know reason classes not allow me put breakpoints , have sources files... does has ever had problem? when try put breakpoint in variable, puts breakpoint in name of class. here share link image: http://tinypic.com/view.php?pic=s4q3p2&s=8#.uzbhq6zge3q thank you!

c++ - Shader transparancy not working with one half -

glenable (gl_blend); glblendfunc (gl_src_alpha, gl_one_minus_src_alpha); and used in fragment shader. i've used alpha blend transparency working seems work 1 side. not sure problem is, new programming , shading. http://imgur.com/wdk4qjc link see picture i think see 2 distant faces blending color darker. maybe culling not activated. face culling ability discard face drawing upon condition. to achieve want, have discard faces not facing camera call backface culling . this: glenablegl(gl_cull_face); //(enable face culling) glcullface(gl_back); //(discard faces)

c# - Where should I connect to context for better performance? -

i want use ef , know 2 way use context accessing data methods of class: 1.passing connection each method of class: public partial class myentity { public static int add(myentityconnection context,myentity input) { context.myentity.addobject(input); context.savechanges(); return input.id; } } 2.using context on each method independently: public partial class myentity { public static int add(myentity input) { using (var context = new myentityconnection()) { context.myentity.addobject(input); context.savechanges(); return input.id; } } } which of above or other ways better? i'd recommend context per request per walther's comment, use dependency injection , repository pattern manage lifetime. something like: how-to inject entity framework dbcontext configurationbasedrepository of sharprepository

how to get clipboard data to a variable in intersystems cache? -

consider have data copied clip board. variable( not in way of pasting on terminal window ),so can able make use of variable. can 1 suggest way of doing it.either using script execution or using class or etc. maybe give more information application: web/zen/csp, tui, other types. anyway, cache, not have special variables clipboard.

haskell - Implementing skipWhile1 in attoparsec -

attoparsec provides function takewhile1 consumes @ least 1 character. however, there no analog skipwhile . how can implement function skipwhile1 ? note: question intentionally shows no research effort answered q&a-style. another possible implementation: import control.applicative skipwhile1 p = skip p *> skipwhile p this might faster @uli's answer because takewhile builds result string, whereas skipwhile doesn't. laziness might make them equivalent (ie. maybe takewhile doesn't build string if don't use it); can't test @ moment verify this.

unity3d - Unity saying "the associated script is not valid" for the default scripts -

i working on project , got point when had write first script. when wrote it, every other script in unity stopped working. it says "the associated script cannot loaded, please fix compile errors , assign valid script.". i have not edited of other scripts, should work , when import them in project work. can't start on because have put weeks worth of work , if start on won't guarantee won't happen again. here script #pragma strict function start () { private var doorisopen:boolean=false; private var doortimer:float=0.0; private var currentdoor:gameobject; public var dooropentime:float=3.0; public var dooropensound:audioclip; public var doorshutsound:audioclip; } function update () { if(dooropen){ doortimer+=time.deltatime; if(doortimer>dooropentime){ door(doorshutsound,false,"doorshut",currentdoor); } doortimer = 0.0; } } } function door(aclip : audioclip ,...