Posts

Showing posts from May, 2014

encryption - Convert ecryption/decryption function from Python to PHP -

i have python script encrypt/decrypt urls: # -*- coding: utf-8 -*- import base64 operator import itemgetter class crypturl: def __init__(self): self.key = 'secret' def encode(self, str): enc = [] in range(len(str)): key_c = self.key[i % len(self.key)] enc_c = chr((ord(str[i]) + ord(key_c)) % 256) enc.append(enc_c) return base64.urlsafe_b64encode("".join(enc)) def decode(self, str): dec = [] str = base64.urlsafe_b64decode(str) in range(len(str)): key_c = self.key[i % len(self.key)] dec_c = chr((256 + ord(str[i]) - ord(key_c)) % 256) dec.append(dec_c) return "".join(dec) url = "http://google.com"; print crypturl().encode(url.decode('utf-8')) this works fine. example above url converted 29nx4p-joszs4czg2jpg4di= , decryption brings url. now want convert php function. far encryption w...

Android - Button text center gravity not working -

Image
i have xml layout in app (example of 1 button): <scrollview xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/scrollviewmain" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#ffffff" > <relativelayout android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#fff0e8" > ///some views <button android:id="@+id/btnvysledkysportka" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignbottom="@+id/chcksprotka" android:layout_alignright="@+id/chcksprotka" android:layout_aligntop="@+id/chcksprotka" android:layout_margin="3dp" android:la...

Import Excel data into an existing SQL Server 2005 table -

Image
i'm trying import data excel sheet existing sql server 2005 table. the table has following columns: name, surname, phonenumber ,bill and in same order in excel sheet. i've never attempted such thing before, after searching while told use: insert table select * openrowset('microsoft.jet.oledb.4.0', 'excel 8.0;database=c:\temp\test.xls', 'select * [sheet1$]') do need reference column names excel sheet sql server table columns? i'm not sql guru, consider myself beginner. can help? see here in management studio : choose db? choose source : and here following gui !!

rally - How do you tell you are running in debug mode in sdk2? -

how tell programatically in sdk2 if running in debug (local) mode (not installed in rally)? i looking in rally.app.context didn't see obvious there nothing in context purpose, far know, here trick can tell if running in rally, or outside: if (window.parent.rally.alm) { console.log('inside'); } else{ console.log('outside'); }

In pure javascript how do you transverse up a DOM element and target the parent? -

this question has answer here: javascript parent element , write holder div siblings 2 answers without using jquery , plain javascript. how 1 select parent of child element? example: <div> <p> <em class="stuff">abc</em> </p> </div> how select parent div container via class stuff ? its in pure javascript element.parentnode

Rails 4: form_for with nested resource and without -

in app, when regular user logs in, dropped in on dashboard displays service requests company belong_to . when admin logs in, dropped onto dashboard displays of company logos can login , file service requests. the views between regular user , admin user virtually exact same, outside of 1 or 2 entities on form (which controlled via cancan ). trying able use same form if admin creates sr or regular user creates sr. routes.rb: resources :service_requests resources :notes end namespace :admin '', to: 'dashboard#index', as: '/' resources :companies resources :service_requests, only: [:index, :new] end end if admin logs in , clicks on company logo , clicks create new sr, route /admin/companies/1/service_requests/new . if regular user logs in is, /service_requests/new . confused on how reuse same form both admin , non-admin side. because setting company_id on sr in create resource in servicerequestscontroller i fol...

C++ Find Certain Element in Queue -

the idea simple , task needs queue, please dont suggest other methods. i need have full queue, example 5 elements of (5,4,3,2,1) , user has enter position of element want moved front. e.g, position 3, element 2. new queue be: 2,5,4,3,1... i have been working on long time isnt hit wall ask help. nudge me working in right direction again :) thanks queue representations pretty arbitrary. i'd use deque: #include <deque> #include <algorithm> #include <iostream> int main() { std::deque<int> queue { 5, 4, 3, 2, 1 }; auto b = begin(queue); std::cout << "which element? "; int n; if (std::cin >> n && n > 0 && size_t(n) <= queue.size()) { std::rotate(b, b+n-1, b+n); (auto : queue) std::cout << << " "; } else { std::cout << "invalid input\n"; } } see live on coliru if queue mean lifo-access onl...

Issues installing meteor exe windows -

on old system able install meteor exe , worked fine im getting error , im not sure go here seems processing path long thats self generated downloading initial meteor files... 100 ########################################################################### download complete (34 mb) extracting files c:\users\sprigs\appdata\local.meteor ................................................................................ .... error processing path: c:\users\sprigs\appdata\local.meteor~\packages\less\4bf6154c28\plugin.compileless.os\npm\compileless\plugin\node_modules\less\node_modules\request\node_modules\form-data\node_modules\combined-stream\node_modules\delayedstream\test\integration\test-delayed-http-upload.js deleting directory: c:\users\sprigs\appdata\local.meteor~ unexpected exception: system.io.pathtoolongexception: specified path, file name, or both long. qualified file name must less 260 characters, , directory name must less 248 characters. @ system.io.path.safesetstac...

javascript - getting backbone to serve static html files -

here directory structure on server public/js/... /css/... /img/... /demo /demo/button/index.html /demo/slider/index.html /demo/dialogbox/index.html in normal backbone route handler, need create view object in which, there model. model fetch data rest api upon initialization. when comes static pages, bit confused since still in learning stage. question: how configure backbone router serve static html pages under demo folder? simple answer: don't. the (simplified) way website (using backbone) works is: client requests page web server web server sends page (sometimes including backobne app) client receives web page, web browser renders page (executing backbone code, if any) backbone router handles hash changes , updates data on page (possibly making ajax requests), without ever requesting new page server backbone doesn't static pages: client requests them (e.g. clicking on link), , web server sends them. in other words, follows ste...

java.lang.ClassCastException: android.widget.LinearLayout$LayoutParams cannot be cast to android.widget.FrameLayout -

aim : removing framelayout screen logcat : 04-05 09:19:44.915: e/androidruntime(26483): fatal exception: main 04-05 09:19:44.915: e/androidruntime(26483): //java.lang.classcastexception: android.widget.linearlayout$layoutparams cannot cast android.widget.framelayout$layoutparams 04-05 09:19:44.915: e/androidruntime(26483): @ android.widget.framelayout.onmeasure(framelayout.java:311) 04-05 09:19:44.915: e/androidruntime(26483): @ android.view.view.measure(view.java:15775) 04-05 09:19:44.915: e/androidruntime(26483): @ .. android.widget.linearlayout.measurechildbeforelayout(linearlayout.java:1411) 04-05 09:19:44.915: e/androidruntime(26483): @ android.widget.linearlayout.measurevertical(linearlayout.java:698) 04-05 09:19:44.915: e/androidruntime(26483): @ android.widget.linearlayout.onmeasure(linearlayout.java:588) 04-05 09:19:44.915: e/androidruntime(26483): @ android.view.view.measure(view.java:15775) 04-05 09:19:44.915: e/androidruntime(26483): @ android....

c# - Populate textbox with selected items from database -

private void fillproduct() { sqlconnection conn = new sqlconnection("data source=station21\\sqlexpress;initial catalog=mydb;integrated security=true"); conn.open(); string query = "select prodid product"; sqlcommand cmd = new sqlcommand(query, conn); sqldataadapter da = new sqldataadapter(cmd); datatable dt = new datatable(); da.fill(dt); if (dt.rows.count > 0) { cmbpcode.datasource = dt; cmbpcode.displaymember = "prodid"; cmbpcode.valuemember = "prodid"; } private void cmbpcode_selectedindexchanged(object sender, eventargs e) { sqlconnection con = new sqlconnection("data source=station21\\sqlexpress;initial catalog=mydb;integrated security=true"); con.open(); string query = "select * product prodid = '"+cmbpcode.text+"'".tostring(); sqlcommand cmd = new sqlcommand(query, con); sqlda...

How to make a new SAPI voice for text-to-speech? -

anyone know how create own sapi tts voices? there docs / apis / algorithms? have not slightest idea begin. want use voice in own software , want able sell can used in other 3rd party apps. you need make component implement ttsengine api, see documentation details: tts engine vendor porting guide for practical example of engine implementation can download sample engine can check espeak sapi implementation .

java - Is it possible to include only the used classes in a war file with maven build? -

say have dependency in pom.xml file: <dependency> <groupid>javax</groupid> <artifactid>javaee-api</artifactid> <version>6.0</version> </dependency> when clean install all javaee-api-6.0.jar included in war file under web-inf\lib folder. is possible instead of including whole jar, classes use , dependencies included? if you're deploying java ee application server, entire jar provided application server, , can omitted war file. can accomplish putting provided scope: <dependency> <groupid>javax</groupid> <artifactid>javaee-api</artifactid> <version>6.0</version> <scope>provided</scope> </dependency> that makes dependency available compilation , test execution, not package war. in contrast, trying determine individual classes need can include class files pointless endeveor. jvm loads classes when used ...

scala - Calling tell on an actor with a new properties file -

i'm creating actor : mysupervisor = actorsys.actorof(props.create(myactor.class, createproperties())); public myproperties createproperties(){ myproperties mp = new myproperties(); mp.setparam1("test1"); mp.setparam2("test2"); return mp; } public class myproperties { private string param1; private string param2; public string getparam1() { return param1; } public void setparam1(string param1) { this.param1 = param1; } public string getparam2() { return param2; } public void setparam2(string param2) { this.param2 = param2; } } myactor : public class myactor extends untypedactor{ private myproperties props; @override public void onreceive(object argmessage) throws exception { if(argmessage instanceof myproperties ){ this.props = (myproperties) argmessage; } actorref newactor = getcontex...

ios - EXC_BAD_ACCESS (code 2) when calling 'presentViewController' -

i'm stumped here. _vc = [[vlckitviewcontrolleriphone alloc]initwithnibname:@"vlckitviewcontrolleriphone" bundle:nil]; _vc.modalpresentationstyle = uimodalpresentationfullscreen; [self presentviewcontroller:_vc animated:yes completion:nil]; gives me exc_bad_access (code = 2, address = 0x0) when presentviewcontroller method called. view controller not nil. happens or without nib name. if comment out presentviewcontroller line, rest of code continues fine, including method calls made view controller itself. view controller running, can't see because it's not showing view. i enabled nszombies , tried instruments running, it's not showing me anything. app quits , instruments stops without giving me information. know problem might be? you can try this if ([controller respondstoselector:@selector(setmodalpresentationstyle:)]) { [controller setmodalpresentationstyle:uimodalpresentationfullscreen]; } else { [controller setmodalpresentation...

javascript - Handlebars variables for cleaner templates (handlebars.js)? -

so code can make html ugly , confusing. {{#if user.facebook.id}} <img class="img-rounded" src="https://graph.facebook.com/{{user.facebook.id}}/picture"/> {{else}} <img class="img-rounded" src="http://www.gravatar.com/avatar/{{user.local.gravatar}}?s=50"/> {{/if}} in javascript could var picture; if(user.facebook.id) { picture = '<img class="img-rounded" src="https://graph.facebook.com/'+user.facebook.id+'/picture"/>'; } else { picture = '<img class="img-rounded" src="http://www.gravatar.com/avatar/'+user.local.gravitar+'?s=50"/>'; } return picture; you know , call picture , know do. there way in handlebars. used in underscore.js. do need create handlebars helper method, or there built in can leverage? handlebar helper method going best bet if dont html version. {{checkfacebookid user.facebook.id user.loc...

android - How do i display the catch exception? -

i want ask how display catch exception in android know if application catching error.. example on this. try { codes here..... } catch (ioexception e) { //how dpslay exception } thank in advance. you can use: try { // codes here..... } catch(ioexception e){ log.d("my_app", "---------------------"); //separator other logs (optional) e.printstacktrace(); log.d("my_app", "---------------------"); //separator other logs (optional) }

jquery - Javascript post data without using AJAX -

hi have anchr tag on whcih submitting form seen below: <form id="myform" action="main/postdata"> first name: <input type="text" name="fname"><br> last name: <input type="text" name="lname"><br><br> <a onclick="myfunction()" value="submit form">click</a> </form> <script> function myfunction() { document.getelementbyid("myform").submit(); } </script> is there anyway can append post data additional value when user clicks, if had 2 tags establish 1 clicked? eg: <form id="myform" action="main/postdata"> first name: <input type="text" name="fname"><br> last name: <input type="text" name="lname"><br><br> <a onclick="myfunction()" value="submit form">click</a> -- ? check 1 clicked? <...

c++ - Insert a value in 2dim vector? -

i copied 2dim array vector below vector< vector<int>> path2; vector<int> temp; // simplicity (int x = 0; x <= 1; x++) {temp.clear(); (int y = 0; y < 4; y++) { temp.push_back(path1[x][y]); } path2.push_back(temp); } now want inser value in second dimention how can it?(i know how use inser() in 1 dim vector) for example path2[0][6,0,2,6] path2[1][6,1,3,6] now how can insert 4 between 1 , 3 ? thank in advance using std::vector::insert path2[1].insert( path2[1].begin()+2, 4 );

c++ - Qt update() doesn't work -

i have problem , update() function in qgraphicsitem doesn't work. want , when move circle , other qgraphicsitem ( in mean time roundrect ) changes color. example, want do: circle.cpp: void circleitem::mousemoveevent(qgraphicsscenemouseevent *event) { // roundrect object rectitem->setbackground(); qgraphicsitem::mousemoveevent( event ); } roundrect.cpp: void roundrectitem::setbackground() { changebackground = true; update(); } void roundrectitem::paint(qpainter *painter, const qstyleoptiongraphicsitem *option, qwidget *widget) { qrectf rec = qrectf( qpoint( 0,0 ), boundingrect().size() / 2 ); roundrect = qrectf(rec.adjusted(-rec.height() / 2, 0, rec.height()/2, 0)); roundrect.moveto( boundingrect().center().x() - roundrect.width() / 2, boundingrect().center().y() - roundrect.height() / 2 ); if( !changebackground ) painter->setbrush( backbrush ); else painter->setbrush( qbrush( qt:...

apache - Simulating MVC/CoC folder structure in php with mod_rewrite -

my project directory structure: project_root/ |- src/ | |- model/ | |- view/ | |- controller/ | -- ...others -- resources/ |- css/ |- js/ -- images/ ok, somewhere in src there file responsible redirecting controllers, views , on, let src/url_mapping.php , prepared solve kind of url, such /{controller}/{action}/{id}?{query} , there no problem here, big deal not want user realize folder structure exists, want hide them , let flow simples ror , other based systems. i want allow http://host/{css,js,images}/* resources without allowing http://host/resources/* itself, , http://host/{controller}/{action}/{id}?{query} src/url_mapping.php file denying direct access http://host/src . for now, closest managed following .htaccess file: <ifmodule mod_rewrite.c> rewriteengine on rewritebase / rewritecond %{document_root}/resources/$1 !-f rewritecond %{document_root}/resources/$1 !-d rewritecond %{document_root}/resources/$1 !-l rewrite...

ruby - using an alias name for hash key value -

i have json data receive , json.parse hash. hash key names integer strings data["0"] , data["1"] , data["2"] , etc... each value correspond state. 0 => start, 1 => stop, 2 => restart. i can't change source json data make key more readable. each hash have 5 pairs correspond 5 different states. i wondering if there nice way me alias numbers meaningful names when referencing hash key value don't have use number. at moment i'm using constants below, thinking there might nicer, more ruby way. use hash or struct can use data[states.start] or something? state_start = "0" state_stop = "1" state_restart = "2" data = json.parse value puts data[state_start] thanks i think constants fine. if want rubify code bit, can, example, wrap source hash in object translate method names. class myhash def initialize(hash) @hash = hash end mapping = { start: ...

c - ListEntry class usage -

#include <windows.h> #include "stdafx.h" #include "list.h" typedef struct list_node { list_entry list; int val1; }list_node, *plist_node; int _tmain(int argc, _tchar* argv[]) { int = 0; plist_node pnewnode; pnewnode = new list_node; list_entry head; initializelisthead(&head); (i = 0; < 3; i++) { pnewnode = new list_node; pnewnode->val1 = i; inserttaillist(&head, &pnewnode->list); pnewnode = null; } while (!islistempty(&head)) { plist_entry removenode = removeheadlist(&head); plist_node mydatanode = (plist_node)containing_record (removenode,list_node,val1); printf("%d\n", mydatanode->val1); } return 0; } with code not getting val1 data gives me junk value?any thing wrong doing? please read...

android - parse-ruby-client - How to send push notification from Rails website with this? -

i create ruby on rails website uses parse https://github.com/adelevie/parse-ruby-client found @ https://parse.com/docs/api_libraries . website , android phone able communicate. push notifications main priority. here problem: cannot parse-ruby-client work @ all. still new rails. when try install parse-ruby-client following error: temporarily enhancing path include devkit... building native extensions. take while... error: error installing parse-ruby-client: error: failed build gem native extension. c:/railsinstaller/ruby1.9.3/bin/ruby.exe extconf.rb checking curl-config... no checking main() in -lcurl... no *** extconf.rb failed *** not create makefile due reason, lack of necessary libraries and/or headers. check mkmf.log file more details. may need configuration options. provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir...

web services - Failure to emit css link html using html_receive and html_post -

trying straightforward.. emit html link stylesheet, explained here, on swi prolog page: repositioning html css , javascript links : http://www.swi-prolog.org/pldoc/man?section=html-post the included library is: :- use_module(library(http/html_write)). i have generic dcg rule outputting css, per example: css(url) --> html_post(css, link([ type('text/css'), rel('stylesheet'), href(url) ])). then example says 'next insert unique css links..', example given doesn't supply parameter unique url inserted. i'm guessing @ this: reply_html_page([title('mytitle'), \html_receive(css('/my.css'))], [ div([id='mydivid'], 'divstuff..' ) ]). but running not output css expected.. title gets processed, css link missing. content-type: text/html; charset=utf-8 <!doctype html> <html> <head> <title>mytitle</title> <meta http-equiv=...

Java: Passing generic type to an another generic type class -

main.java : main class creating object of test of generic type test.java: generic class creating object of wrapper class of generic type wrapper.java: generic class of type passing string,long type creating test.java object . , passing long type creating object of wrapper class. main.java: public class mainclass { test<string,long> test; mainclass() { test = new test<string,long>(){}; } public static void main(string[] arr) { mainclass m = new mainclass(); } } test.java public class test<t,u> { wrapper<u> mywrapper; test() { type type = this.getclass().getgenericsuperclass(); system.out.println("type: " + type.tostring()); type type1 = ((parameterizedtype)this.getclass().getgenericsuperclass()).getactualtypearguments()[0]; system.out.println("type1: " + type1.getclass().getname()); type[] types = ((parameterizedtype)type).getactual...

c# - How to save html2canvas image into System Folder in jquery -

i have form id="form1" inside form have graph.now using html2canvas image of form1.here code.. <script type="text/javascript"> $(document).ready(function () { $('#add_button').click(function () { alert("hiii"); $('form1').html2canvas(); var queue = html2canvas.parse(); var canvas = html2canvas.renderer(queue, { elements: { length: 1} }); var img = canvas.todataurl(); window.open(img); alert("hello"); }); }); </script> <form id="form1" runat="server"> <div style="padding-left:150px"> <asp:literal id="fcliteral1" runat="server"></asp:literal> </div> <div style="padding-left:350px"><b>demo</b></div> </form> <input type="submit" id="add_butto...

xcode - Cannot symbolicate iOS crash report based on archive of distributed version -

i dealing situation app works in development mode can crash in version appeared on app store. if download app app store can reproduce crash. i can see both submitted *.xcarchive archive , *.crash crash report in xcode 5.1’s organizer (under “archives” , “devices” tabs respectively), crash report not symbolicated. selecting crash report , selecting re-symbolicate not help. if follow apple’s instructions under how match crash report build observe uuid in crash report same uuid armv7s in app binary. crash occurred on iphone 5s, seems fine. i have total of 3 archives app in xcode. offending 1 in middle. how can xcode symbolicate crash file correctly?

windows - Compiling c++ and cuda code with MinGW in QTCreator -

im trying compile simple cuda program (i took source code compiling cuda code in qt creator on windows ) .pro file: target = cuda # define output directories destdir = release objects_dir = release/obj cuda_objects_dir = release/cuda # sourcefiles sources += main.cpp # makes .cu files appear in project other_files += vectoraddition.cu # cuda settings <-- may change depending on system cuda_sources += vectoraddition.cu cuda_sdk = "c:/cuda/cudasamples" # path cuda sdk install cuda_dir = "c:/cuda/cudatoolkit" # path cuda toolkit install system_name = win32 # depending on system either 'win32', 'x64', or 'win64' system_type = 32 # '32' or '64', depending on system cuda_arch = sm_11 # type of cuda architecture, example 'compute_10', 'compute_11', 'sm_10' temp = 'c:\program files (x86)\microsoft visual studio 10.0\vc\bin' #tried add vs compiler ...

html - show content when hover -

i need change style if hover on media-body checkbox should show up .media-body ul:hover input[type="checkbox"] { display: block; } html: <div class="media-body"> <ul> <li><a style="float:left;">{{inventory.manufacturer}} {{inventory.model}}</a> <li><input style="float:right; display: none;" type="checkbox" ng-model="inventory.checked" ng-checked="inventory.checked"></li><br/> </ul> </div> inline css has higher priority outline, you're changes applied still overridden inline styles. the simplest trick make work set !important css. .media-body ul:hover input[type="checkbox"] { display: block !important; } jsfiddle: http://jsfiddle.net/wgqt5/ anyway right way put inline styles outside of html. moreover html not valid. should <div class="media-body">...

java - How to debug NoClassDefFoundError originating from a 3rd party jar? -

i getting noclassdeffounderror while interacting 3rd party class further native calls. wanted know best way debug such error? exception in thread "main" java.lang.noclassdeffounderror: com/somelib/someclass @ mytest.foo(mytest.java:28) @ mytest.main(mytest.java:11) caused by: java.lang.classnotfoundexception: com.somelib.someclass @ java.net.urlclassloader$1.run(urlclassloader.java:366) @ java.net.urlclassloader$1.run(urlclassloader.java:355) @ java.security.accesscontroller.doprivileged(native method) @ java.net.urlclassloader.findclass(urlclassloader.java:354) @ java.lang.classloader.loadclass(classloader.java:424) @ sun.misc.launcher$appclassloader.loadclass(launcher.java:308) @ java.lang.classloader.loadclass(classloader.java:357) ... 2 more

javascript - How to solve trouble by blocking requests for one URI in node.js? -

i want solve problem of blocking requests same uri. using express routing requests. app.get('/task', function(req, res){ console.log("geted"); settimeout(function(){ res.json({"status":"ok"}); res.end(); },10000); }); if make 2 sequential request uri [localhost / task], second "geted" appears after execution of first request. 10 seconds after first request. geted /task 200 10016ms - 20b geted /task 200 10005ms - 20b requests other uri not locked (thanks express), though time, not yet sent 2 identical request. the question why , how avoid / fix problem? nodejs v10.26.0 express v3.4.8 this not node problem, caused browser. if send 2 identical requests in 1 browser instance (say, 2 open tabs in same browser), browser not send second request until first 1 finished. try opening 2 different browsers, 1 chrome , 1 firefox, , send request once each. i'm betting see behave way expect.

winforms - Flatten XML to DataGridView using C#/Linq -

there many questions out there, 1 quite unique can assure you! need generic solution flatten xml data 2 column grid (field, value) real challenge hierarchy of xml data different each response! this audit data stored in database in xml format, cannot change structure of these responses need handle hierarchy possible , display results user in simple grid. here sample of xml structure: <xml> <results> <resultsdto> <reportid>173601</reportid> <results> <displayname>item 1</displayname> <someparameter>blahblah</someparameter> <hidden>false</hidden> <values> <value>10</value> <resulttype>percentage</resulttype> </values> <values> <value>some.pdf</value> <resulttype>pdf</resulttype> </values> <values> <...

amazon web services - Unable to install R/rmr2 on AWS EMR -

having spent around week trying install r , rmr2 on aws-emr, turning little help. bootstrap script installing r 2.14.1-1~lennycran.0 (thanks jd long's blog). when trying install rmr2 having classic dependency problem. seems have install packages rcpp, rjsonio, bitops, digest , 5 more. because older rcpp works r 2.14.1, downloading named version , installing it. how old, don't know - randomly tried few versions , 0.8.9 worked. make few more hit-and-trials. sudo curl -o rcpp.tar.gz http://cran.us.r-project.org/src/contrib/archive/rcpp/rcpp_0.8.9.tar.gz sudo r cmd install rcpp.tar.gz now supposed install rest of dependencies (how?) and rmr2 installed. using following script, which, of course fails - sudo wget --no-check-certificate -o rmr2.tar.qz -s -t 10 -t 5 http://goo.gl/dvbric sudo r cmd install rmr2.tar.gz my question - what should simple bootstrap script installing rest of dependencies ("rjsonio", "bitops", "digest", "functi...

sinatra - Heroku: Force Error Backtrace To Display In Development Mode -

Image
i running sinatra application on heroku, , i'm seeing generic error page: stuff i've tried far heroku logs returns generic "h10 - application crashed" error, doesn't tell me actual cause is. i've used heroku config vars set rack_env=development , verified set way using heroku config . thought force backtrace displayed on screen not. questions how can force backtrace displayed in dev mode? what else can track down source of error? i got response heroku support this. everything did correct, problem application boot errors won't display screen, , boot error. source of error further in backtrace in heroku logs , in fact right place in case, missed it. setting rack_env=development correct way display application runtime errors screen, according support.

Java. XML. how to validate certain part of xml document against XSD Schema? -

i have soap response web-service in string , document formats, , have method validates it. problem have validate node <result> . i have got node, not know how child nodes tags , etc. node result = (node)xpath.compile("//result").evaluate(xmldocument, xpathconstants.node); <result> <playerid>some id</playerid> <partneruid>some partner uid</partneruid> <registrationlevel>some registration level</registrationlevel> <properties> <property> <key>some key</key> <value>some value</value> </property> <property>...</property> </result> thanks help i validate xml file against xsd using way.i think you. public string validatexmlschema() throws saxexception, ioexception { file folder = new file("xsdpath"); file[] listoffiles = folder....

mysql - Count columns where -

my problem in db table, amx_admins_servers columns admin_id , server_id , custom_flags , use_static_bantime , looks like database link and need count columns (server_id) have value of 4, 7, 10, 12 , print server_id 4 - x times server_id 7 - x times server_id 10 - x times server_id 12 - x times the sample data shows 4 servers; if there other servers, though, should not shown. any ideas? select server_id, count(*) x_times amx_admins_servers server_id in (4, 7, 10, 12) group server_id

python - Random int without importing 'random' -

is there way let program select random number between 1 , 1,000 without importing 'random'? help appreciated. based on random source code : def randint(a, b): "return random integer in range [a, b], including both end points." return + randbelow(b - + 1) def randbelow(n): "return random int in range [0,n). raises valueerror if n<=0." if n <= 0: raise valueerror k = n.bit_length() numbytes = (k + 7) // 8 while true: r = int.from_bytes(random_bytes(numbytes), 'big') r >>= numbytes * 8 - k if r < n: return r def random_bytes(n): "return n random bytes" open('/dev/urandom', 'rb') file: return file.read(n) example: print(randint(1, 1000)) you implement random_bytes() using prng .

c# - how to write a code to get the value of Priority, triage etc which comes under DisplayForm in tfs -

below code how triage , priority values tfsteamprojectcollection tpc = new tfsteamprojectcollection( new uri("http://abc1.com")); workitemstore workitemstore = (workitemstore)tpc.getservice(typeof(workitemstore)); workitemcollection queryresults = workitemstore.query("select [state], [title] workitems [work item type] = 'task' , ([state] <> 'resolved' , [state] <> 'closed') , [assigned to] = 'test' , [keywordsearch] not contains 'test1'"); foreach (workitem queryresult in queryresults ) { int taskid = queryresult.id; int taskpriority = queryresult.displayform; // how value of priority string tasktriage = queryresult.displayform;//how value of triage string taskstate = queryresult.state; datetime taskchangeddate = queryresult.changeddate; string tasktitle = queryre...

php - Creating dynamic Highcharts based on an array -

to sort off cap i'm doing.. have loop creates table information pulled database. i've setup superglobal variable inside loop assigns 1 of table field values variable; part works no problem. the problem when try call variable inside highcharts function, doesn't work. charts don't show up. $(document).ready(function() { var $container = $('$global_var'); highcharts.setoptions({ chart: { backgroundcolor: { lineargradient: [0, 0, 500, 500], stops: [ [0, 'rgb(255, 255, 255)'], [1, 'rgb(240, 240, 255)'] ] }, borderwidth: 2, plotbackgroundcolor: 'rgba(255, 255, 255, .9)', plotshadow: true, plotborderwidth: 1 } }); var chart1 = new highcharts.chart({ chart: { ...

javascript - How can I bind ngModel through multiple directives with isolate scopes in AngularJs? -

i trying bind property via ngmodel in layer of directives 3 levels deep. fine, except middle level contains ng-if believe creates new scope. binding lost @ point. i have created jsfiddle explain situation: http://jsfiddle.net/5fmck/2/ note works if ng-if directive removed, using ng-if instead of ng-show performance reasons does know how can original ngmodel update 'inputdirective' template in fiddle? simple :3 just remember, child scope created = use reference $parent :) <div ng-if='somecondition'> <span>in wrapper</span> <input-directive ng-model='$parent.ngmodel'></input-directive> </div> http://jsfiddle.net/5fmck/3/ // upd as know need use reference $parent if ngmodel primitive, not object.

javascript - Ajax Form Returns Error -

i trying post form through ajax in netsuite trigger event after form submit without reloading it. please me out, newbie ajax. here code $('#du_joinnow').submit(function(e){ e.preventdefault(); //stop default action var formdata = $(this).serializearray(); $.ajaxsubmit({ type: "post", url: "https://forms.na1.netsuite.com/app/site/crm/externalleadpage.nl?compid=xxxxxx&formid=1&h=xxxxxxxxxxxxxx"+ formdata, data: formdata, success:function(data, textstatus, jqxhr) { $('#overlay').fadein(); //data: return data server }, error: function(jqxhr, textstatus, errorthrown) { alert("ajax call failed.");//if fails } }); return false; }); instead of $.ajaxsubmit $.ajax full code: $('#du_joinnow').submit(function (e) { e.preventdefault(); //stop default action var formdata = $(this).serializearray(); $.ajax({ type: "post", url: ...

angularjs - ng-flow.js, how to display responsed JSON data in HTML or controller -

i'm using ng-flow, script named ng-flow-standalone.js here: https://github.com/flowjs/ng-flow my concept when user adding new item, upload field showing , once photo uploaded additional form fields showing e.g. title, description. in code, app create product_id, image_id , saving file. once saving process complete, return product_id, image_id , etc in json format. html, hidden form fields displayed once product_id defined. i see json responded server in console log not know how display in html or angular controller. can't see how-to in docs , demo. can me? thanks example code: .. <script src="/assets/js/ng-flow-standalone.js"></script> .. <div class="row"> <div class="col-md-4" flow-init="{target:'upload_image.json'}" flow-file-added="!!{png:1,gif:1,jpg:1,jpeg:1}[$file.getextension()]"> <div class="panel panel-default"> <div class="panel-heading...

Can i connect between Android and IOS By WIFI-Direct? -

i want transfer file between android , ios wifi-direct android have wifip2p library and ios have multipear connectivity library wifi-direct but not compatible between 2 libraries !!! each other can't found network service how connect between android , ios transfer file ???? you have use nsinputstream & nsoutputstream connect android. it's not simple task. first, @property (nonatomic, strong, readwrite) nsinputstream *inputstream; @property (nonatomic, strong, readwrite) nsoutputstream *outputstream; then add method, - (void)initnetworkcommunication { uint portno = 5555; cfreadstreamref readstream; cfwritestreamref writestream; cfstreamcreatepairwithsockettohost(null, (cfstringref)@"localhost", portno, &readstream, &writestream); inputstream = (__bridge nsinputstream *)readstream; outputstream = (__bridge nsoutputstream *)writestream; [inputstream setdelegate:self]; [outputstream setdeleg...

html - table-cell span wrong height -

i have fiddle , going on, span bigger should be. html <div class="input-group"> <input type="text" class="input-group-addon rounded-left" placeholder="search music"> <span class="input-group-addon">test</span> <span class="input-group-addon rounded-right">search</span> </div> css .input-group { display: table; order-collapse: separate; } .input-group-addon{ border: 1px solid #333; display: table-cell; height: 50px; } simply add "line-height" propery value equal "height". in case "50px": .input-group-addon { border: 1px solid #333333; display: table-cell; height: 50px; line-height: 50px; }