Posts

Showing posts from February, 2011

c - replace if/else with while/if statement -

c - replace if/else with while/if statement - is possible replace if/else statement while , if statement(s) (say, we're working in c)? if it's possible, can please share example. so, have if (cond1) exec1 else exec2 and want rid of if/else , utilize if/while constructs. is plenty turing finish language have while/if statements (for command flow)? how if/else constructs? (this not homework, out of curiosity) for general replacement of if() ... else ... construct, can cache result of condition: int status = cond1; if(condition) exec1; if(!condition) exec2; that way avoid issues sideeffects in cond1 , exec1 . concerning question turing completeness: paul griffiths notes, if() , goto sufficient. however, if() , recursion. can replace while(cond1) exec1; loop self recursive function: void loopy(/*whatever state loop touches*/) { if(cond1) { exec1; loopy(/*pass on current state*/); } } this fa

ios - Possible to check segue from which viewcontroller then do something? -

ios - Possible to check segue from which viewcontroller then do something? - for illustration have 3 views: savecontactview (tableview - editable) detailedcontactview (view - display only) listcontactview (tableview - display list) listcontactview contains dynamic records of customers. tap on cell segue detailedcontactview. listcontactview contains 'add' button segue savecontactview. savecontactview when user save go detailedcontactview. detailedcontactview, user can 'edit' , goes savecontactview this question: listcontactview detailedcontactview or savecontactview detailedcontactview on viewdidload on detailedcontactview possible phone call different methods/functions when comes view? i not want create redundant duplicated 'alike' view. there best approach? you can apply check in viewdidload of detailedcontactview parent of view. if using force segue check parent view controller of view controller in uinavigationcontroler stack

javascript - Programatically record audio output from web page using jS or html5? -

javascript - Programatically record audio output from web page using jS or html5? - is there way programatically capture sound beingness played webpage using html5, js, or else , create mp3/wav file out of it? know of web sound api, i've been able find info on recording sound microphone input, rather output of web page. thanks you can utilize web sound api record output of web sound node, not microphone input. if webpage want record sound using web sound api generate sound, can utilize web sound api record (check out recorder.js). if sound beingness played html elements, can turn web sound node , record it. check out: http://updates.html5rocks.com/2012/02/html5-audio-and-the-web-audio-api-are-bffs javascript html5 audio audio-recording

Yammer API - Creating a post on Yammer -

Yammer API - Creating a post on Yammer - i'm trying utilize yammer api create post on yammer, have next code: <!doctype html> <html lang="en" xmlns="http://www.w3.org/tr/html5/"> <head> <meta charset="utf-8" /> <title>yammernotification - version 1</title> <script src="https://assets.yammer.com/platform/yam.js"></script> <script> yam.config({ appid: "app-id" }); </script> </head> <body> <button onclick='post()'>post on yammer!</button> <script> function post() { yam.getloginstatus(function (response) { if (response.authresponse) { yam.request( { url: "https://www.yammer.com/api/v1/messages.json" , method: "post" , data: {

c++ - convert php code to C (sha1 algorithm) -

c++ - convert php code to C (sha1 algorithm) - php code: <?php $pass = "12345678"; $salt = "1234"; echo sha1($salt.$pass.$salt); ?> my c code utilize sha1 using openssl crypto library at:http://www.openssl.org/docs/crypto/sha.html. #include <openssl/sha.h> int main() { const char str[] = "original string"; const char salt[] = "1234"; const char pass[] = "12345678"; strcat(str, salt, pass); unsigned char hash[sha_digest_length]; // == 20 sha1(str, sizeof(str) - 1, hash); // stuff hash homecoming 0; } my question is, how can modify c code exact same thing php code? thanks. you need allocate plenty space in string concatenated string. also, can't modify const char , don't utilize modifier on variable you're concatenating into. char str[17] = ""; // 16 characters plus null terminator const char salt[] = "1234"; const char pass[] = "123

android - Linkify links in textview and let user select which program open links instead of internal browser -

android - Linkify links in textview and let user select which program open links instead of internal browser - i have textview applied linkify create links. linkify.addlinks(mtextview, linkify.all); now when users click on links, apps open links in native browser. want users have alternative select favorite browser showing "complete action using" dialog. how can add together feature linkified links? you can utilize clickablespan, , set textview it public class linkspan extends clickablespan { private onclicklistener listener; public linkspan(onclicklistener listener){ this.listener = listener; } @override public void onclick(view widget) { listener.onclick(widget); } } public class linkifyutil { private activity activity; public linkifyutil(activity activity){ this.activity = activity; } public void addautochooserlink(final intent intent,textview text){ string source = text.gettext().tostring(); strin

powershell - Export only the machines that meets criteria -

powershell - Export only the machines that meets criteria - i have script works great export machines meet 1 of 3 conditions in foreach statement. right exports machines, have clean manually in excel. #create ldap searcher object , pass in dn of domain wish query $searcher = new-object system.directoryservices.directorysearcher([adsi]"ldap://dc=ten,dc=thomsonreuters,dc=com") #pass in ceriteria searching for. #in case we're looking computers enabled , running windows 7 $searcher.filter = "(&(objectcategory=computer)(objectclass=computer)(!useraccountcontrol:1.2.840.113556.1.4.803:=2)(operatingsystem=windows 7*))" $searcher.pagesize = 100000 # populate general sheet(1) info $results = $searcher.findall() $results | foreach-object { $_.getdirectoryentry() } | select @{ n = 'cn'; e = { ($_.cn) } }, @{ n = 'distinguishedname'; e = { $_.distinguishedname } }, @{ n = 'extensionattribute7'; e = { $_.extensionattribute7 } }, @{

Convert SQL computer to ROLL UP sql server 2012 since its no longer support compute -

Convert SQL computer to ROLL UP sql server 2012 since its no longer support compute - i have db this: for meaning: lop: class sinhvien: student khoa: department monhoc: subject diemthi: mark i want query list class , number of class belong each department select khoa.makhoa,tenkhoa,malop,tenlop khoa,lop khoa.makhoa=lop.makhoa order khoa.makhoa compute count(malop) khoa.makhoa and result but, sql 2012 no longer back upwards compute, said it's can done roll can't syntax, please help me update 1: radar's result, more help you can replace compute rollup , grouping by select khoa.makhoa,tenkhoa,malop,tenlop , count(malop) khoa,lop khoa.makhoa=lop.makhoa grouping khoa.makhoa,tenkhoa,malop,tenlop rollup sql sql-server sql-server-2012 rollup

ruby - MYSQL setting Foreign Key ERROR 1452 (23000) -

ruby - MYSQL setting Foreign Key ERROR 1452 (23000) - i have users , rota table in mysql database , trying add together set foreign key called user_id in rota table. error after executing line of code in terminal: alter table rota add together foreign key (user_id) references users(id); and error is: error 1452 (23000): cannot add together or update kid row: foreign key constraint fails ( sharp2_development . #sql-b19_ada , constraint #sql-b19_ada_ibfk_1 foreign key ( user_id ) references users ( id )) i have user_id column in rota type int, no null, default no , no user table's id same apart beingness primary key , auto_increment. mysql ruby database foreign-keys primary-key

module - Drupal statistics does not count visits when I see the node from a custom panel -

module - Drupal statistics does not count visits when I see the node from a custom panel - i have web site each node has 3 diferents designs (i through panels , arguments) , utilize statistics module, way can see how many visits has node. but statistics module jus count visits when visit main design. can explain example: website .com/node/01 <---when user visit url, visit counted website .com/node/01/mobile <----- here not counted visit website .com/node/01/lightbox <----here not counted visit this built panels , arguments... so, there anyway set php code in 2 panels visitors don't have start count? best, it's because panels doesn't invoke node_view(). please seek next code: function module_ctools_render_alter(&$info, &$page, &$context) { if ($context['handler']->task == 'node_view') { $key = $context['handler']->conf['context']; $node = $context['contexts'][$key]->da

angularjs - Why am I getting an exception when trying to debug my Jasmine test (they run just fine)? -

angularjs - Why am I getting an exception when trying to debug my Jasmine test (they run just fine)? - i have unit tests very simple test angular controller. when run them, execute successfully; however, when seek debug them, exception. i running vs 2013, angularjs 1.2, resharper 8.2, jasmine 1.3, , phantomjs 1.9.7. here simple controller: (function() { var app = angular.module("permutedmultiples", []); function maincontroller($scope) { $scope.answer = -1; $scope.n = 0; } app.controller("maincontroller", ["$scope", maincontroller]); })(); here simple test suite: ///<reference path="/scripts/jasmine.js"/> ///<reference path="/scripts/angular.js"/> ///<reference path="/scripts/angular-mocks.js"/> ///<reference path="/scripts/app/maincontroller.js"/> describe("main controller tests.", function () { var scope; beforeeach(mo

How to Populate An Array of Month Number In jQuery - Javascript -

How to Populate An Array of Month Number In jQuery - Javascript - can please take @ this demo , allow me know how can dynamically populate number of each month current year in jquery or javascript? var monthnames = ["january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december"]; var daysinmonth = []; var d = new date(); var n = d.getmonth(); (var = 0; < monthnames.length; i++) { daysinmonth.push(d.getmonth()); } console.log(daysinmonth); var monthnames = ["january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december"]; var daysinmonth = []; (var = 0; < monthnames.length; i++) { var year = 2014; v

deployment - Why does the command 'meteor deploy' upload so much data? -

deployment - Why does the command 'meteor deploy' upload so much data? - $ meteor --version meteor 0.9.4 $ meteor create todos $ cd todos $ meteor deploy blah uploading... [= ] 7% 484.0s uploading it takes 8 minutes because uploads 30mb file. i think understand reason big files, /local contains local database, why info beingness uploaded each deployment? my actual app closer 70mb (immediately after running meteor reset ) , typically don't have access fast upload bandwidth help cut down spread of gray hair if knew how speed things up. when meteor bundles app takes code (which files see in project) , creates nodejs bundle meteor code in too. the meteor code framework , nodejs modules & quite big. uploaded meteor deploy server. deployment meteor

css - Can't override theme's default text color (android) -

css - Can't override theme's default text color (android) - i want have 1 list view different text color instead theme's default color.i can override text size , style , row background color text color remains theme's default. can tell me i'm doing wrong? styles.xml: <resources> <!-- base of operations application theme, dependent on api level. theme replaced appbasetheme res/values-vxx/styles.xml on newer devices. --> <style name="appbasetheme" parent="theme.appcompat.light"> <!-- theme customizations available in newer api levels can go in res/values-vxx/styles.xml, while customizations related backward-compatibility can go here. --> </style> <!-- application theme. --> <style name="apptheme" parent="appbasetheme"> <!-- customizations not specific particular api-level can go here. --> </style> <style name="

ALL vs ANY evaluation in SQL Server -

ALL vs ANY evaluation in SQL Server - i'm trying out below query: select distinct code, case when id = (select distinct u.id unit u left bring together unit_const uc on u.id = uc.hid u.property = 502 , type = 'acq') 1 else 0 end case_eval, (select distinct u.id unit u left bring together unit_const uc on u.id = uc.hid u.property = 502 , type = 'acq') evaluation unit property = 502 which correctly gives below result: +---------------------------------------+ | code case_eval evaluation | +-------------------------------------

r - RStudio can not use git in Yosemite -

r - RStudio can not use git in Yosemite - after upgrading mac yosemite, not able utilize git in rstudio anymore. (i can still utilize source tree or git independently rstudio) not sure whether related path issue posted here: running scheme command r console cannot locate installed programs since upgrading mac osx 10.10 i tried above solution, did not work. in rstudio, specified path git in tools/global options.../"git/svn" correctly (as used before) but, in in tools/project options.../"git/svn":version command system alternative left (none) . rstudio: 0.98.1074 (updated 0.98.1083, still not work) version _ platform x86_64-apple-darwin10.8.0 arch x86_64 os darwin10.8.0 scheme x86_64, darwin10.8.0 status major 3 minor 1.0 year 2014 month 04 day 10 svn rev 65387 language r version.string r version 3.1.0

pinvoke - Calling a unmanaged C method with a const char** argument from managed C# code -

pinvoke - Calling a unmanaged C method with a const char** argument from managed C# code - i know when calling unmanaged method accepting char* argument c#, possible pass stringbuilder , have unmanaged c code modify it. have know size info want set stringbuilder, can pass buffer of right size. have found many threads helping this. however, have c method accepts char** argument. this allows methods check_if_encrypted (shown below) provide malloc 'd error messages without calling method having know how much space allocate error message buffer, using next code in check_if_encrypted : *strthecharstarstarargument = strlocalmallocderrormessage , , calling passing &strerrormessage strerrormessage char* what dllimport signature should used such method in c#? for example, have next c code: header: extern __declspec(dllexport) keyfile *create_source_key_file_from_path(char *strpath); extern __declspec(dllexport) int check_if_encrypted(keyfile *kfsourcekey, int

Read and write to Access DB with C# -

Read and write to Access DB with C# - i making basic programme friend of mine need basic database. have 3 tables @ max, wondering if possible utilize access database files in c# normal sql database , if how? have seen tutorials using oledb none give me clear way things. it doesn't go access need throw reply based on ops' intention digg sqlite. so go sqlite simplicity , efficiency. see these posts on fast , easy way work sqlite , entity framework: getting started, using sqlite .net using sqlite entity framework 6 , repository pattern sqlite entity framework code first , migration entity framework 5 on sqlite portable databases (ii): using sqlite entity framework c# ms-access oledb

svn - svnadmin load error -> loads first revisions again -

svn - svnadmin load error -> loads first revisions again - i running svn server on ubuntu 12.04 , made svn backup via: svnadmin dump ./backup/repo > repo.dump now tried restore , made new repo via: svnadmin create repo svnadmin load ./repo < ./backup/repo.dump but after revision 83 gets weird , next error: <<< started new transaction, based on original revision 83 * editing path : test/file1.wbg ... done. * editing path : test/file2.wbg ... done. ------- committed revision 83 >>> <<< started new transaction, based on original revision 1 * adding path : pic2.png ... done. ------- committed new rev 84 (loaded original rev 1) >>> <<< started new transaction, based on original revision 2 * adding path : pic.png ... done. ------- committed new rev 85 (loaded original rev 2) >>> <<< started new transaction, based on original revision 3 * deleting path : pic.png ... done

batch file - What's wrong with my SVN hook script-----pre-commit.bat? -

batch file - What's wrong with my SVN hook script-----pre-commit.bat? - i wrote pre-commit hook script svn running on windows ( .bat ). the main purposes are: checking reversion log length; prevent normal users deleting [repo]/trunk/ folder; prevent normal users deleting [repo]/trunk/xxx/ folders; but svn says: command syntax not right (exitcode 255) the code here: @echo off :: stops commits have empty log messages. @echo off setlocal set repos=%1 set txn=%2 rem check log length. svnlook log -t "%txn%" "%repos%" | findstr ".........." > nul if %errorlevel% gtr 0 goto nolog @echo off set drop=no rem check delete operation on trunk svnlook changed -t "%txn%" "%repos%" | findstr "^d[ ]*trunk//$" if %errorlevel% == 0 (set drop=yes) rem check delete operation on subdirectory of trunk svnlook changed -t "%txn%" "%repos%" | findstr "^d[ ]*trunk/[.]*//$" if %errorlev

python - Using an __init__ argument in other functions of the same class -

python - Using an __init__ argument in other functions of the same class - so i'm trying design class weapon scheme in text based game. basically, want swords deal 1-6 harm , add together harm based on weapons modifier. got class work if phone call function in class modifier, want set class 1 time , not have type multiple times this code have. import dice #uses random generation simulate dice rolls class sword(): def __init__(self, name, modifier): self.name = name self.mod = modifier def dmg(self, modifier): base of operations = dice.d6 self.dmg = base of operations + modifier homecoming self.dmg x = sword("sword of coolness", 1) print x.name print x.dmg(1) that's why did self.mod = modifier . value available methods self.mod . can create method: def dmg(self): base of operations = dice.d6 self.dmg = base of operations + self.mod homecoming self.dmg as ys-l notes,

write java program -

write java program - import java.util.scanner; public class treasure { public static void main(string[] args) { scanner variable=new scanner(system.in); int a,b,c,d,e,f,g,h,i,j; a=variable.nextint(); b=variable.nextint(); c=variable.nextint(); d=variable.nextint(); e=variable.nextint(); f=variable.nextint(); g=variable.nextint(); h=variable.nextint(); i=variable.nextint(); j=variable.nextint(); while(variable%2==0) { system.out.println("its number"+a); system.out.println("its number"+b); system.out.println("its number"+c); system.out.println("its number"+d); system.out.println("its number"+e); system.out.println("its number"+f); system.out.println("its number"+g); system.out.println("its number"+h); system.out.println("its number"+i); system.out.println("its number"+j); } system.out.println("its odd number"); } } write java programme r

kernel - irqs_disabled() vs in_interrupt() in linux -

kernel - irqs_disabled() vs in_interrupt() in linux - what difference between these 2 functions in linux. know irqs_disabled() homecoming whether irqs disabled or not , in_interrupt() homecoming whether in interrupt context or not. default if in interrupt context doesn't mean irqs disabled? what scenarios utilize these functions specifically? consider these 2 cases: 1) there platform back upwards nested interrupts, 1 interrupt can occur when hasn't returned yet. priorities configured in interrupt controller registers. 2) multi core cpu can process 2 interrupts @ same time, on @ each core. there many reasons check if function running in interrupt context, i.e: functions uses thread locking, shall not executed in interrupt context otherwise deadlock occur. these functions might want check if interrupt context , abort error. also, there many reasons disable interrupts, i.e.: when writing memory construction consumed interrupt handler, might fill info

perl - How can I filter '?' out of XML? -

perl - How can I filter '?' out of XML? - i have xml info this: class="lang-xml prettyprint-override"> <?xml version="1.0"?> <a> <b>someone ? messed up</b> <c>this question mark has disappear too?</c> </a> now object validate if every opening tag has closing one, , filter out question marks in between <b> tags using perl. i tried different variations of $_[0] =~ s|>(.*)\?(.*)<|>$1$2<|g; but cuts off <? , ?> . how can work without ruining xml version tag? also, using xml::simple overkill checking if tags closed properly? regex not best solution fix xml. to prepare regex question mark thing this kind of flawed regex. flawed because fixes single ? . s/>([^<>]*?)[ ]?\?[ ]?([^<>]+?)</>$1 $2</g # >([^<>]*?)[ ]?\?[ ]?([^<>]+?)< > ( [^<>]*? ) [ ]? \? [ ]? ( [^<>]+? ) < xml

ruby - Can't seem to install rubocop gem using Rails 4 -

ruby - Can't seem to install rubocop gem using Rails 4 - i tried installing rubocop adding suggested line rails project's gemfile: gem 'rubocop', require: false after running bundle , installs , visible in gemfile.lock. however when running $ rubocop application's root receive error: -bash: rubocop: command not found i tried running $ rubocop , , nil comes up. i've tried running $ gem install rubocop , no difference in behavior. here excerpt gemfile.lock: rubocop (0.27.0) astrolabe (~> 1.3) parser (>= 2.2.0.pre.6, < 3.0) powerpack (~> 0.0.6) rainbow (>= 1.99.1, < 3.0) ruby-progressbar (~> 1.4) you have run command: source ~/.bashrc as right after running $ bundle command gem installed , environment set in ~/.bashrc , since continued utilize old bash session didn't rubocop available command in bash. hence, either re-login in bash(close , open terminal again) or run command stated above.

How ot remove a jquery function from textbox using jquery -

How ot remove a jquery function from textbox using jquery - i have asp.net textbox assign datepicker when search alternative date, want unbind datepicker function when search alternative changes else other date. below code. $("#<%=ddlsearchby.clientid%>").change(function () { var cbovalue = $("#<%=ddlsearchby.clientid%>").find("option:selected").text(); if (cbovalue == "date") { $("#<%=txtsearchby.clientid%>").datepicker(); } else { $("#<%=txtsearchby.clientid%>").removedata("datepicker"); } }); here don't know in else part of alter event. googled alot problem did not find solutions. if can help me datepicker has "method" that: $("#<%=txtsearchby.clientid%>").datepicker("destroy"); you

android - MenuItem tinting on AppCompat Toolbar -

android - MenuItem tinting on AppCompat Toolbar - when utilize drawables appcompat library toolbar menu items tinting works expected. this: <item android:id="@+id/action_clear" android:icon="@drawable/abc_ic_clear_mtrl_alpha" <-- appcompat android:title="@string/clear" /> but if utilize own drawables or re-create drawables appcompat library own project not tint @ all. <item android:id="@+id/action_clear" android:icon="@drawable/abc_ic_clear_mtrl_alpha_copy" <-- re-create appcompat android:title="@string/clear" /> is there special magic in appcompat toolbar tint drawables library? way work own drawables? running on api level 19 device compilesdkversion = 21 , targetsdkversion = 21 , , using appcompat abc_ic_clear_mtrl_alpha_copy exact re-create of abc_ic_clear_mtrl_alpha png appcompat edit: the tinting based on value have set android:textcolorprim

android - Google Plus Logout button not working -

android - Google Plus Logout button not working - i have followed quick start sample app google developer site https://developers.google.com/+/quickstart/android , worked pretty sign in button, signout , revoke buttons on same activity. but when tried move signout button new activity , calls signout button started crashing. this i'm trying : @override public void onconnected(bundle connectionhint) { // reaching onconnected means consider user signed in. log.i(tag, "onconnected"); // update user interface reflect user signed in. // retrieve profile info personalize our app user. person currentuser = plus.peopleapi.getcurrentperson(mgoogleapiclient); mstatus.settext(string.format( getresources().getstring(r.string.signed_in_as), currentuser.getdisplayname())); intent myintent = new intent(loginactivity.this, logoutactivityty.class); //myintent.putextra("gusername", currentuser.getdisplayname(

Registering and Storing External Claims in ASP.NET Identity -

Registering and Storing External Claims in ASP.NET Identity - i'm using facebook auth , trying register user token claim can't seem work right. able working manually adding in linklogincallback method of manage controller provided default mvc template, approach seems cumbersome , incorrect, in removing , updating token. i've read can find documentation on lacking , think have code written it's supposed never registers , stores claim in db. solution i'm working @ moment follows in startup.auth: var fboptions = new facebookauthenticationoptions(); fboptions.scope.add("email"); fboptions.scope.add("user_photos"); fboptions.appid = "[myappid]"; fboptions.appsecret = "[myappsecret]"; fboptions.provider = new facebookauthenticationprovider() { onauthenticated = async context => { context.identity.addclaim( new system.

node.js - Take different action based on number of times npm "forever" restarts -

node.js - Take different action based on number of times npm "forever" restarts - i'm running express server behind forever . let's there lot of crashes x within specified period of time n (due runtime error in newest deploy, example). instead of restarting script x+1th time, want run cleanup script roll previous version, other cleanup, , restart. possible forever ? node.js forever

java - JavaFX TextFlow without linebreaks -

java - JavaFX TextFlow without linebreaks - is there way prevent javafx textflow command or text children nodes break lines. want textflow without line break growing horizontally. textflow textflow = new textflow(); text text = new text("a verrrrryyyyy llllooooonnnnggggg text shouldn't contain line breaks."); textflow.getchildren().add(text); setting setwrappingwidth high value didn't remove line breaks me. help appreciated. to quote api doc of textflow: the wrapping width of layout determined region's current width. can specified application setting textflow's preferred width. if no wrapping desired, application can either set preferred double.max_value or region.use_computed_size. i tried briefly , depending on parent container seems work intended it. java javafx textflow

ios - XCTests for SLComposeViewController -

ios - XCTests for SLComposeViewController - i trying write unit test cases using xctest slcomposeviewcontroller , couldn't find solution far.any suggestion in terms of approach , code helpful. my objective test below code using xctest slcomposeviewcontroller *tweetsheet = [slcomposeviewcontroller composeviewcontrollerforservicetype:slservicetypetwitter]; slcomposeviewcontrollercompletionhandler __block completionhandler = ^(slcomposeviewcontrollerresult result) { [tweetsheet dismissviewcontrolleranimated:yes completion:nil]; switch(result) { case slcomposeviewcontrollerresultcancelled: { [self showalertwithtitle:nil andmsg:nslocalizedstring(@"sharing failed", @"workout summary text")]; }

android - How to get float value from json? -

android - How to get float value from json? - i retrieving value jsondata httpclient client = new defaulthttpclient(); httpconnectionparams.setconnectiontimeout(client.getparams(), 10000); httpresponse response; httpget gett = new httpget(url); response = client.execute(get); bufferedreader reader = new bufferedreader(new putstreamreader(response.getentity().getcontent(), "utf-8")); orignalresponse = reader.readline(); jsontokener tokener = new jsontokener(orignalresponse); jsonobject jsondata = new jsonobject(tokener); log.v("amount", "amount :"+jsondata.get("amount")); i want retrieve "amount" "23868352383.00" while retrieving using jsondata.get("amount") , gives value "2.3868352383e10", using jsondata.getdouble("amount") , gives value "2.3868352383e10" using jsondata.getlong("amount") removes fraction part how can retrieve value ?? please help.

sql - Why is a group by clause required when rows are limited in where clause? -

sql - Why is a group by clause required when rows are limited in where clause? - fiid primary key of table1. why query homecoming many rows there fiid in table1. fiid beingness limited 1 row in clause. query performs when grouping table1.fiid added, certainly should not needed? thanks. select table1.fiid, sum(case table2.type in (4,7) table2.valuetosum else 0 end), table1 inner bring together table3 on table1.fiid = table3.parentid inner bring together table2 on table2.leid = table3.fiid table1.fiid = 76813 , table2.insid = 431144 when using aggregate functions in select such sum , count when selecting other columns well, group by including additional columns required. while don't know exact reason behind this, helps set

Show Div based on default radio button selected using javascript -

Show Div based on default radio button selected using javascript - i have form based on 2 radio buttons. want show div if 1 radio button selected on page load. if value 'yes' saved on form on each page load div should shown. if no value saved on form div should not visible. p.s. have implemented functionality on div show , hide on radio button selection javascript. here code:- first section of page. <script> function yesnoinscheck() { if (document.getelementbyid('yesinscheck').checked) { document.getelementbyid('showexplain').style.display = 'block'; style.opacity = 0; settimeout(fade, 40); } else document.getelementbyid('showexplain').style.display = 'none'; style.opacity = 1; set

mysql - Mirror tables: triggers, deadlock and implicit commits -

mysql - Mirror tables: triggers, deadlock and implicit commits - i'm have 2 similar tables, illustration , b. i want replicate insertions in b, , insertions in b integrate 2 users systems . configured "after insert triggers" on each one. example: delimiter $$ create definer = `root`@`localhost` trigger `after_a_insert` after insert on `a` each row begin insert `b` set `id` = new.`id`,`name` = new.`name`; end$$ delimiter ; delimiter $$ create definer = `root`@`localhost` trigger `after_b_insert` after insert on `b` each row begin insert `a` set `id` = new.`id`,`name` = new.`name`; end$$ delimiter ; if insert in a, triggers calls insert in b, insert executes trigger in b , deadlock occurs avoiding infinite loop. i've tried edit triggers drop table trigger before insert , create 1 time again after it. example: delimiter $$ create definer = `root`@`localhost` trigger `after_b_insert` after insert on `b` each row begin drop trigger if exists `after_a

javascript - Script to return null on string values in Mule Datamapper -

javascript - Script to return null on string values in Mule Datamapper - i have element of type double in info mapper called capital. values come excel spreadsheet. when there no capital values "n/a" in excel. next error in mapper: caused by: com.opensys.cloveretl.component.spreadsheet.exception.spreadsheetexception: cannot number value cell of type string in m3 in record 1, field 13 ("capital"), metadata how can script mapper homecoming null or 0 whenever value of type string comes through? you can utilize java methods available on info types when working script. looks problem here don't know if input value going string ("n/a") or decimal value. solve that, can take approach of converting string test , take appropriate action. don't have excel info mapper set @ moment didn't seek out, think should work. output.captial = ((""+input.capital).equals("n/a") ? 0 : input.cellvalue); by addin

c# - Application.exe is not a valid Win32 application error -

c# - Application.exe is not a valid Win32 application error - i have written console application client trying run on windows server 2003 r2 machine machine , error message. if go build -> configuration manager projects set platform of "any cpu" , configuration of "release" what else might have missed? don't want run console application double clicking on it, want give windows schedules tasks can pick , rn on times starting .net 4.5, compiler generates exe that's marked compatible windows version 6.0 , greater. vista , up. such executable fail run when started on xp , server 2003, windows versions 5.0. error before can tell .net 4.5 isn't installed on machine. you must target .net 4.0 or less. same requirement on dlls have dependency on, including unmanaged ones. more in this post. c# visual-studio-2012 windows-console

get any input focus element in windows with c# -

get any input focus element in windows with c# - is there anyway focus input (textbox) on screen app active in windows?? i want create console application read rfid tag , set value (result) on input box that focusing. please advise. possible? you can utilize method send keys other applications textbox: c# using sendkey function send key application c#

java - Having trouble with the umano android slidinguppanel 2 views as sliding child -

java - Having trouble with the umano android slidinguppanel 2 views as sliding child - i using library umanoandroidslidinguppanel , works fine theres problem cant fix. main kid mapview (static main view) working fine , sec kid (the slidinguppanel) responsive html file in webview , imageview. problem when swipe slide panel cant scroll html file within webview. library states can create single view draggable can scroll other dont know how help appreciated. heres xml file <com.sothree.slidinguppanel.slidinguppanellayout xmlns:sothree="http://schemas.android.com/apk/res-auto" xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/sliding_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="bottom" sothree:panelheight="50dp" sothree:shadowheight="4dp"> <fragment android:id="@

c# - foreach loop and "Object reference not set to an instance of an object" -

c# - foreach loop and "Object reference not set to an instance of an object" - i using code: setcontentview (resource.layout.results); // create application here string[] listresults = intent.getstringarrayextra ("resultdata"); linearlayout linear = findviewbyid<linearlayout> (resource.id.linear); textview resultspaste = findviewbyid<textview> (resource.id.resultspaste); foreach(string item in listresults) { resultspaste.text += item; }; and receiving object reference not set instance of object next foreach . have researched , can't find on it. why receiving error? listresults, resultspaste or both null. set breakpoint before foreach , check variables. c# foreach xamarin

python - Using a variable inside another variable -

python - Using a variable inside another variable - this question has reply here: how do variable variables in python? 8 answers what trying create user enters name, programme takes that, adds word move , grabs set named *name*move . here code far, want within ** : fredmove = set(["move1","move2","move3","move4"]) #different info joemove = set(["move","move","move3","move4"]) #for each name chrismove = set(["move1","move2","move3","move4"]) #this timmove = set(["move1","move2","move3","move4"]) #easier write out #i have many more lists, name = input("what name looking for? ").lower def movechecking(move1,move2,move3,move4,name): if (move1 not in *name*moves): print("m

WPF Progressbar Rectangle -

WPF Progressbar Rectangle - i using next progressbar style : <style targettype="{x:type progressbar}"> <setter property="template"> <setter.value> <controltemplate targettype="{x:type progressbar}"> <grid minheight="14" minwidth="400" background="{templatebinding background}"> <border x:name="part_track" cornerradius="2" borderthickness="1"> <border.borderbrush> <solidcolorbrush color="#ffffff" /> </border.borderbrush> </border> <border x:name="part_indicator" cornerradius="2" borderthickness="1" horizontalalignment="left" background="{templatebinding foreground}" margin="0,-1,0,1">

Testing for 3 way conditions in C -

Testing for 3 way conditions in C - how test 3 way conditions in c? for illustration (pseudo format): if n , z , p { print nzp } else if (n , z) , not p { print nz } ........... if (n && z) { if (p) print nzp else print nz } c condition

javascript - Return angular ngView to nothing -

javascript - Return angular ngView to nothing - i have routes in angular script so: app.config(function($routeprovider) { $routeprovider .when("/contact", { templateurl : "views/contact.html", controller : "generalctrl" }); }); now have links happily take me contact page so: <a href="#contact">contact</a> <div ng-view></div> now have link want remove view site goes looking did before user clicked on contact link. next doesn't work , refreshes page: <a href="#">home</a> how work? if declare in routes config, set template , controller? has none. need apply ng-leave classes view well. using angular 1.3. just utilize $routeprovide.otherwise , utilize redirectto property redirect home template app.config(function($routeprovider) { $routeprovider .when("/", { templateurl : 'views/home.html', controller : 'homecontrol

.net - ASP.NET Register WebControl to use in ASPX Page -

.net - ASP.NET Register WebControl to use in ASPX Page - i have created webcontrol videostreaming video streaming using next link: video streaming aspnet signalr , html5 videostreaming.vb <assembly: owinstartup(gettype(videostreaming))> namespace lantern.demo.client.customcontrol public class videostreaming inherits webcontrol '.... code here end class end namespace after writing code, declared/added/registered command in web.config file as: <pages> <controls> <add assembly="videostreaming" tagprefix="web" namespace="lantern.demo.client.customcontrol"/> </controls> </pages> but not able add together in aspx page regular control. trying: <web:videostreaming runat="server" id="video" clientidmode="static" width="300px" height="300px" interval="100" source="true" scalingmode=

msbuild - Visual Studio Online continuous deployment to Azure Website with publish profile -

msbuild - Visual Studio Online continuous deployment to Azure Website with publish profile - i using visual studio online deploy project continuously after ci build pass. have utilize publish profile build production web.config transform deployed website using production db instead of dev db. have followed scott hanselman's blog post add together msbuild arguments in ci build definition. arguments this: /p:deployonbuild=true /p:publishprofile=[publish profile name] /p:allowuntrustedcertificate=true /p:username=[credentials obtained azure website portal] /p:password=[from portal well] it seems working, deployed website using production db now. then noticed in ci build definition under deployment section, there 1 parameter called: path deployment settings. this article, says: "the path .pubxml file website, relative root folder of repo. ignored cloud services." which want. removed msbuild arguments, set path deployment settings select pubxml file in popu

JQuery selector [name^="value"] which starts with an string followed by a variable is not working -

JQuery selector [name^="value"] which starts with an string followed by a variable is not working - attribute starts selector [name^="value"] not working. $('[id^="editme_" + 'id']').css("display","none"); here 'editme_' string , 'id' variable. thanks in advance. you have not handled quotes correctly. use: $('[id^="editme_'+id+'"]').css("display","none"); also can utilize .hide() instead of .css("display","none") jquery jquery-selectors

c# - Equal query in Elasticsearch by Nest client -

c# - Equal query in Elasticsearch by Nest client - public class user { public string email { get; set; } } client.index(new user { email ="test@test.te" }); query in linq c# illustration : rep.where(user=>user.email=="test@test.te"); thats work correct. i utilize same query in nest: client.search<post>(q => q .query(qu => qu .term(te=>te.onfield("email").value("test@test.te")))); document result count zero!! : client.search<post>(q => q .query(qu => qu .term(te=>te.onfield("email").value("test")))); document result count 1 !!why! how can create equal-quey in elasticsearch it's because analyzers. document parsed terms while indexing, means elasticsearch stores array of strings ["test", "test", "te"] in row document. depending on anayzer configured (i guess it's standard one), may different terms decomposition. on o

sql server - looking for procedure instead of trigger which we can schedule as a job -

sql server - looking for procedure instead of trigger which we can schedule as a job - instead of trigger planning write procedure can run using job work same way trigger these 2 tables in same way. how can that? here tables column names 1.tblcal id(int,not null) uid(varchar(10),null) desc(varchar(200),null) date(datetime,null) avbl(varchar(5),null) 2.tblevent id(int,notnull) uid(varchar(10),null) desc(varchar(200),null) date(datetime,null) down trigger on tblevent.. alter trigger [dbo].[tru] on [dbo].[tblevent] insert declare @cuid char(6), @cudesc char(40), @cudate datetime set nocount on select @cuid = i.uid , @cudesc=i.desc, @cudate=i.date inserted if(@cudesc !='available') begin update tblcal set avbl='out', desc=@curdesc cadate=@cudate , uid=@cuid end set nocount off i have problem desc column.desc going in , out need update tblcal differently different descriptions;in case don't think trigger reliable;means illustration 10 desc ne

debugging - Ruby Error: Expecting keyword_end? -

debugging - Ruby Error: Expecting keyword_end? - hey i've got little ruby programme wrote , except syntax error life of me can not debug.obviously, because of programme nor running. my code below, help appreciated! def print_game_header # print header print "\n" print "welcome math buddy\n" print "\n" end def make_game_array game_array x in 0..4 y in 0..4 game_array[x][y] = "*" end end end def make_mines game_array x in 0..4 game_array[x][rand(0..4)] = '!' end end def print_game_board game_array x in 0..4 y in 0..4 game_array[x][rand(0..4)]="!" end end def print_game_board game_array x in 0..4 y in 0..4 print game_array[x][y] end print "\n" end end def compute_results game_array print "\nfor 5x5 grid abov

racket - Scheme - application: not a procedure error -

racket - Scheme - application: not a procedure error - i'm coding function in scheme i'm getting "application: not procedure; expected procedure can applied arguments" error. assume haven't used conditional statements correctly: (define find-allocations (lambda (n l) (if (null? l) '() (cons ((if (<=(get-property (car l) 'capacity) n) (cons (car l) (find-allocations (- n (get-property (car l) 'capacity)) (cdr l))) '())) (if (<=(get-property (car l) 'capacity) n) (cons (car l) (find-allocations (n (cdr l)))) '()))))) if can point out error that'd much appreciated. try this: (define find-allocations (lambda (n l) (if (null? l) '() (cons (if (<= (get-property (car l) 'capacity) n) (cons (car l) (find-allocations (- n (get-property (car l) 'capacity)) (cdr l)))

jsf - Serialization and streams from database images -

jsf - Serialization and streams from database images - for web app using jsf makes heavy utilize of images stored in database, planning utilize @applicationscoped object (images may shared among sessions). object have java.util.dictionary fellow member database id key , instance of internal class value store image , other info associated image. multiple sessions may access same image simultaneously , each can decide image should deleted, otherwise image immutable. new images may added database external process. my general approach follows: when image requested, key in dictionary. if not there, load image database , store in dictionary. provide access image caller. when image marked deletion user, set flag in value , exit. other sessions may using image still. when value in dictionary destroyed, delete image in database if marked such. how can ensure marked-for-deletion flag respected when dictionary value destroyed? insofar aware (i relatively new java experienced c++

c# - Failed binding data to DataGrid -

c# - Failed binding data to DataGrid - can tell me, please , why cannot recieve desired result in column company (here, name of company). here have tried bind source info ( class person) wpf datagrid. surname | name | company --------------------------------------- sidorov | sasha | datagridbind.company petrov | misha | datagridbind.company mainwindow.xaml.cs: namespace datagridbind { public partial class mainwindow : window { public mainwindow() { initializecomponent(); person person = new person("sasha", "sidorov", new company("teremok") ); person person1 = new person("misha", "petrov",new company("subway")); observablecollection<person> persons = new observablecollection<person> { person, person1 }; persondatagrid.itemssource = persons; } } } person.cs : namespace datagridbind { publi

javabeans - What is the convention with Java beans, and implementing interfaces like Comparable? -

javabeans - What is the convention with Java beans, and implementing interfaces like Comparable? - java beans, far know, should always: have empty constructor have fields, , getter/setter methods these fields. however, wondering convention java beans implement interfaces comparable ? leave java bean pure, meaning absolutely no behaviour, data, , write custom comparator-class. implementing comparable easier though. are there conventions when comes implementing simple mutual interfaces comparable java beans? cannot find consequences myself, feels might breaking rules, , there might haven't thought of. imho question not conventions needs. you right separation of bean stuff business logic style. i'd add together here typically practice because relationship between beans , comparators many-to-many, i.e. you hold several comparators 1 bean class , utilize them in different contexts sometimes can re-use 1 comparator several different classes or create hiera

python - Anti-Aliasing Images in a panel -

python - Anti-Aliasing Images in a panel - i'm setting shape of wxpanel, there lot of jagged edges. there way smooth these out? inside of wx.frame, setting shape black , white .png image mask = wx.image('resources/images/window/window_alpha_map.png') mask.convertalphatomask() shape = mask.converttobitmap() shape.setmask(wx.mask(shape, wx.black)) self.setshape(wx.regionfrombitmap(shape)) inside of wxpanel, setting image in erasebackground def onerasebackground(self, event): dc = event.getdc() if not dc: dc = wx.clientdc(self) rect = self.getupdateregion().getbox() dc.setclippingrect(rect) dc.clear() background = wx.image('resources/images/window/window_background.png') bmp = background.converttobitmap() dc.drawbitmap(bmp, 0, 0) here examples of talking about: http://clfu.se/pzn3 http://clfu.se/ue4 is there way smooth these out in wxpython or trick in photoshop m

javascript - Calling Mailto inside body of another mailto -

javascript - Calling Mailto inside body of another mailto - is possible give mailto within body of mailto? i have vb.net code through opening outlook window. i have below code, smsg = user.redirect("mailto:" + legrev + "& cc=" + cc + "&subject= " + outersubject + "&body=" + body) scriptmanager.registerstartupscript(me.page, me.gettype(), "showalert", smsg, true) public function redirect(byval pagename string) string dim sb new stringbuilder() sb.append("window.location.href='" + pagename + "'; ") homecoming sb.tostring() end function in body string have mailto:" + innerto + "&cc=" + innercc + "&subject= " + innersubject problem getting mail service opened subject set 'innersubject' instead of 'outersubject' i think outersubject getting replaced innersubject. please help asap. the body string needs escape

Getting Website data on android app -

Getting Website data on android app - i trying obtain info of website in android app. tried next code, application launches , simple activity_main.xml displayed loading info on screen. attaching code, please guide me. mainactivity.java: package com.example.httpexample; import android.app.activity; import android.os.bundle; import android.widget.textview; public class mainactivity extends activity { textview httpstuff; @override protected void oncreate(bundle savedinstancestate) { // todo auto-generated method stub super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); httpstuff = (textview) findviewbyid(r.id.tvhttp); getmethodex test = new getmethodex(); string returned; seek { returned = test.getinternetdata(); httpstuff.settext(returned); } catch(exception e) { e.printstacktrace(); } } } getmet