Posts

Showing posts from January, 2015

Iterate Python data structure -

i'm having problems getting head around python data structure: data = {'nmap': {'command_line': u'ls', 'scaninfo': {u'tcp': {'method': u'connect', 'services': u'80,443'}}, 'scanstats': {'downhosts': u'0', 'elapsed': u'1.18', 'timestr': u'wed mar 19 21:37:54 2014', 'totalhosts': u'1', 'uphosts': u'1'}}, 'scan': {u'url': {'addresses': {u'ipv6': u'2001:470:0:63::2'}, 'hostname': u'abc.net', 'status': {'reason': u'syn-ack',

ruby - Sass can't be run unless as superuser Linux Mint -

i'm using linux mint 16 cinnamon, , i've lately installed sass. oddly, can't use sass unless i'm superuser, isn't great... as example, if type sass -v in terminal su, have right sass version displayed. if i'm not su, have message: /usr/lib/ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': not find sass (>= 0) amongst [bundler-1.5.3, bundler-unload-1.0.2, executable-hooks-1.3.1, gem-wrappers-1.2.4, rubygems-bundler-1.4.2, rvm-1.11.3.9] (gem::loaderror) /usr/lib/ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec' /usr/lib/ruby/1.9.1/rubygems.rb:1231:in `gem' /usr/local/bin/sass:22:in `<main>' the same thing happens when want start using it. have su. i've uninstalled/reinstalled sass, doesn't work. any tip, please? you may first want run gem env see difference between returns when particular user , returns when superuser. of results, "gem paths" important here. and when user, can sort

jquery - Creating a custom, responsive website navigation bar / menu -

i've created horizontal fixed navigation bar site i'm working on. i'm trying work out details. i've read bootstrap can these things, attempts implement site lots of own css mess. i'm willing use jquery if necessary. i want navbar fixed @ top of page, , span page's entire width. far, good. i'd navbar's opacity, , maybe color, change when user begins scrolling. (less opaque.) i'd site logo left-aligned, , several navigational buttons right-aligned, , i'd buttons , logos scale responsively based on screen size. don't want right , left aligned elements touch page edges. want padding. i haven't found way implement opacity change, or keep logo , buttons in place , scaling properly. what have, html: <div id="navbar"> <ul> <li><a href="index.html"><img src="logo.png" align="left"></a></li> <li><a href="#1"><img src="

php - Apply pagination to MOODLE website -

we trying apply pagination concept on course category list page in our moodle website , have got success in it. while displaying shows same course on every page. able set how number of topics/categories should shown on each page, , same number of categories shown. each page shows same topic. please if has applied pagination moodle website. the list of courses within category paginated. so i'm guessing mean list of categories? can use flexible table pagination http://docs.moodle.org/dev/lib/tablelib.php you can display 1 section of course going course -> edit settings -> course format -> course layout -> show 1 section per page. but if want display of sections - not 1 - need have @ designing course format http://docs.moodle.org/dev/course_formats

merge - Tortoise SVN Merging committed revisions in same repository -

i'm trying clean repository. since i'm committing changes often, sure, have many changes committed seperately belong together. possible join multiple committed revisions (in same repository) in revision log? i believe straight answer no, workaround: manually put commit comments desired range make copy of updated repository revert latest revision before desired range merge revision head (read "undoing changes" section in this page more info) commit copy step 2 , insert comments

Someone explain SharePoint features -

i trying create sharepoint timer , deploy via sharepoint feature. have bunch of questions. when specify local site use debugging enter path central admin or enter path site? the timer needs process items in list, believe list in specific site, need set local site site url or set root (a level above site?) explain scopes of feature (web, webapplication, site) if ever feature/timer deploy go start/stop/etc? i have followed countless tutorials , run in access denied errors when deploy. or 1 tutorial got feature deploy (a simple page says "hello world") no idea page deployed to. sp dark horse. sharepoint timer scope web application your answers: you set sharepoint site, not central admin. not root, set specific site contains list. web application. you can via stsadm. check out article: http://msdn.microsoft.com/en-us/library/ff798313.aspx http://markanthonyparker.blogspot.in/2010/08/execute-sharepoint-timer-job-using.html

process management - Android how to get name and memory usage of all the running application -

i'm getting processname , pid using activity manager , getprocessmemoryinfo() ,but how exact memory used applications,as i'm getting different memories gettotalprivatedirty() , gettotalpss() , gettotalshareddirty() all above not matching of memory shown in application manager. anyone have idea? as how discover memory usage of application in android? covers, there no such thing "exact memory usage". if want reproduce algorithm application manager uses, @ source code!

grails asset pipeline plugin -

i have read documentation of grails asset pipeline plugin started implementing in sample grails project built in 2.2.3 . installed asset pipeline plugin version 1.7.1 . requirement include jquery.ui.min.js in gsp file included using tag <asset:javascript src="jquery-ui.min.js"/> . also, in config.groovy, have made following entry grails.assets.bundle=true . the problem facing i'm unable access jquery.ui.min.js in gsp file. pease tell me missing , how should proceed not valid solutions query?? i think need reference different file: <asset:javascript src="application.js"/> and application.js contains: //= require jquery-ui.min at top of file (make sure there isn't blank lines above line, other comment lines ok) load lib. see http://bertramdev.github.io/asset-pipeline/guide/usage.html#directives this answer guess based on grails 2.4 gives me out of box. fyi, auto-generated application.js contains: // manifest fil

jpa - SonarQube (Sonar) + EclipseLink: incorrect error 'Comparison of String parameter using == or !=' -

i have following class, using eclipselink jpa: package my.package; import javax.persistence.entity; import javax.persistence.generatedvalue; import javax.persistence.generationtype; import javax.persistence.id; import javax.persistence.sequencegenerator; import javax.persistence.version; import my.package.api.address; @entity(name = "address") @sequencegenerator(name = "sequence", sequencename = "seq_address") public class addressjpaentity implements address { @id @generatedvalue(strategy = generationtype.sequence, generator = "sequence") private long id; @version private long version; private string street; public addressjpaentity() { } public addressjpaentity(string street) { this.street = street; } @override public long getid() { return id; } public long getversion() { return version; } public void setversion(long version) { this.vers

ios - reading a json object from a website in objective c -

i need separate sub person, name, age, home addr, office addr below given json object retrieved website { "person" : [{"subperson":{"home":{"id":"kljljk"},"name":"person3","age":"18","addr":{"home addr":"ksdjr","office addr":"kjshdg"}}}]} tried nsjsonserialization,sbjson , touchjson api's. returns dictionary in person key , else value(format of json string specified below code) code: nsurlrequest *urlreq = [nsurlrequest requestwithurl:url]; nsdata *response = [nsurlconnection sendsynchronousrequest:urlreq returningresponse:nil error:nil]; [webviv loadrequest:urlreq]; sbjsonparser *jsonparser = [sbjsonparser new]; nsdictionary *json = [jsonparser objectwithdata:response]; nslog(@"%@\n", json); for(id key in json) { nslog(@"%@=%@",key,[json objectwithkey: key]); } //output person = (everything

java - JSoup execute method slow on linux -

i'm having issue performance of http request within jsoup. on development pc (windows 7) works great. when deploy same service on suse linux enterprise server, http requests slower. difference +- 15 seconds. (15 seconds slower on linux) jsoup version 1.7.3. java version : 1.7.0_51. the jvm parameters same on both machines. my call: connection.response response = jsoup.connect(urlwrk).data(headerdatamap).cookies(cookiestore).method(httpmethod).useragent(useragent).timeout(requesttimeout).execute(); i'm using post method. i started tcpdump session , looks execute method hangs few seconds before executes http request. any appreciated! you might have slower dns resolution in linux box. check dns servers in /etc/resolv.conf. maybe first 1 not responding , times out before trying second.

c# - No public members in abstract class -

i'm constructing code interacts http web service. interact it, invoke "commands" on it, either http requests or http post. i want create base class (eg, servicecommand) encapsulates , hides httpwebrequest object, i'm not convinced want offer functionality publicly, subclasses. subclasses (for example) searchcommand, or fetchcommand, , these use functionality offered protected methods in base class. basically, question is: considered bad design create classes have protected members, , no public ones. general questions ask myself design: what class is . remember object oriented design objects. if creating new object need able think individual entity (at least abstractly). if providing functionality might better off creating interface or extension methods. does functionality exist? no need create class wrap class worked well. finally private versus public - if think subclasses need access base class values create protected member variable. variab

git - How can I apply changes of a forked repository? -

i have started working github. created new repository. else have forked repository. want know how can apply commits on original repository. i'm agreed it's duplicate answer there bit overhead... you can git pull <fork_repository_address> <fork_branch>

ruby on rails 4 - ActiveAdmin: gem not checkout, run bundle install first -

in rails 4 app, trying use activeadmin 1.0.pre2. bundle install doesn't complain , seems have included gem , works properly. i having in gem file: gem 'activeadmin', github: 'gregbell/active_admin' $> bundle show activeadmin /home/aslam/.rvm/gems/ruby-2.1.0@monaeo/bundler/gems/active_admin-3fb7f03335b1 even after running bundle install several times, keep getting following error: git://github.com/gregbell/active_admin.git (at master) not yet checked out. run `bundle install` first. i using bundler version 1.6.0.rc2 (upgraded 1.5.3) ruby: ruby 2.1.0p0 (2013-12-25 revision 44422) [i686-linux] rails: 4.0.4 i not sure going wrong here? try install prerelease version of bundler: gem install bundler --pre it should solve problem.

c# - Elastic Search with NEST - Async Operations -

looking example of using nest async function - i want index large number of records, maybe 100000. so, use indexmanyasync, don't know enough async. indexmanyasync returns task. looking example of how implement this. the non-async way going was: take 50 records, index, take next 50 records, index, etc... with async, should call indexmanyasync once records? or still 50 @ time? call method, task back, call task.start? make collection of tasks run @ once? etc... looking guidance... there example of using indexmanyasync in nest profiling.indexing.tester.cs class in source repository. should started in right direction.

sql - I need to calculate and the display the sum of the total sales in C# -

i want calculate sum of total sales staff id , calculate total sales month in c# keeps saying input string wrong. here code total sales staff id command.commandtext = "select sum (pricesold) saleline saleline.soldby = '" + combobox10.selecteditem.tostring() + "' "; string cmd = command.commandtext; double result = convert.todouble(cmd); textboxsalesstaffoutput.text = convert.tostring(result); here code sales month command.commandtext = " select sum (saletotalvalue) sales sales.saledate between '" + textboxdate1.text + "' , '" + textboxdate2.text + "'"; string cmd = command.commandtext; textboxsalesmonthoutput.text = convert.tostring(cmd); any ideas of do. you not executing commands. can execute them via executescalar return 1 row , 1 column. here example first query : double result = convert.todouble(cmd.executescalar()); as mentioned in comme

Indexing in a variable string in Matlab -

i have variable input names assign titles of graphs. e.g 'uktreasury_returns', 'china_logreturns', 'us_ret' .... i want extract until underscore in each example. function arguments, have tried: header = inputname(1); subject = header(1:'_'-1); finaltitle = [subject, ' - first 3 pcs']; the '-1' there because not want underscore included in output. this didn't work, , rror message: 'index exceeds matrix dimensions'. how can dynamically reference underscores? tips how solution might extended other indexing problems might face in future? you can't index string constituent characters in matlab. when do: header(1 : '_' - 1); matlab automatically converts char '_' integer index, kind of happens in c. since value of integer exceeds length of string, error mentioned. to achieve trying do, can do: strs = strsplit(header, '_'); subject = strs{1};

jquery - Pass parameter to WebAPI through Uploadify -

how pass object uploadify webapi controller? not sure how use scriptdata parameter. i tried this: $("#fileinput").uploadify({ 'uploader': '/api/files/addfiles/', 'swf' : '/uploadify/uploadify.swf', 'cancelimage' : '/uploadify/uploadify-cancel.png', 'auto': true, 'folder': "/uploads", 'scriptdata' : {'product': null } }); here controller: public task<httpresponsemessage> addfiles(product product ) { } if remove product parameter controller controller gets called( on clicking "select files") , works fine. when try pass parameter not called. route template is: api/{controller}/{action/{id} okay. after bit of investigation found uploadify will work happily standard mvc controller action, not appear pass on scriptdata part of re

jquery - CSS: align image icon of any size in the middle-center of a box -

i've been through several posts , visited other websites still can't find solution this. tried several suggestions no avail , i've been trying several hours since yesterday , today figure solution. please, forgive me if question may duplicate truth none of solutions worked out me. in fact, before rebuilding whole page, appreciate here. boss "simply" wants see icon fit in middle-center of box. since there's no text inside box, vertical-align: middle; not apply. images can different sizes, cannot count on fixed size position it. thanks img { max-width: 100%; max-height: 100%; } .imageholder { margin: 2px 10px; padding: 5px; border: 1px solid #999; background-color: white; display: inline-block; vertical-align: middle; } #contenido .logo-radio .imageholder { width: 72px; height: 72px; } <div class="logo-radio"> <article class="imageholder"> <a href="#"

postgresql - Django on AWS Elastic Beanstalk: Unexpected syncdb error on deploy -

i have django/postgresql application. use elastic beanstalk deploy amazon ec2 instance rds. today, deployment failed following error. older code versions not able deploy. [instance: i-f8ae27ce module: awsebautoscalinggroup configset: null] command failed on instance. return code: 1 output: error occurred during build: command 01_syncdb failed . it's related command in elastic beanstalk config file: command: "django-admin.py syncdb --noinput" digging in log files shows above command raises error: improperlyconfigured("error loading psycopg2 module: %s" % e) django.core.exceptions.improperlyconfigured: error loading psycopg2 module: no module named psycopg2 this weird, because have psycopg2 in requirements.txt, , can verify it's installed. also, have postgresql-devel installed yum package via eb config file. does know why deployment failed?

eclipse - Exception in thread "main" java.lang.NoClassDefFoundError: org/pdfbox/util/PDFTextStripper -

i trying resolve issue. steps taken resolve issue: 1): have downloaded frontbox-1.2.1.jar , pdfbox-1.2.1.jar , went eclipse->build path-> libraries , added jar file. this error: exception in thread "main" java.lang.noclassdeffounderror: org/pdfbox/util/pdftextstripper @ java.lang.class.getdeclaredmethods0(native method) @ java.lang.class.privategetdeclaredmethods(unknown source) @ java.lang.class.getdeclaredmethods(unknown source) @ gate.creole.creoleannotationhandler.processparameters(creoleannotationhandler.java:365) @ gate.creole.creoleannotationhandler.processannotationsforresource(creoleannotationhandler.java:225) @ gate.creole.creoleannotationhandler.processannotations(creoleannotationhandler.java:169) @ gate.creole.creoleannotationhandler.processannotations(creoleannotationhandler.java:173) @ gate.creole.creoleannotationhandler.processannotations(creoleannotationhandler.java:173) @ gate.creole.creoleannotationhandle

CMD - Move files to the folders dependent on the list? -

i have list (list.txt) content: c:\users\computers\39323227 c:\users\computers\39323227.zip c:\users\computers\39328635 c:\users\computers\39328635.zip c:\users\computers\39329113.zip c:\users\computers\39329288.zip c:\users\computers\39331075 c:\users\computers\39331075.zip c:\users\computers\39331386.zip c:\users\computers\39904282 c:\users\computers\39904282.zip c:\users\computers\39905798 c:\users\computers\39905798.zip c:\users\computers\39906307.zip and files , created folders in parent folder clutter this: c:\users\computers\39323227 c:\users\computers\39328635 c:\users\computers\39331075 c:\users\computers\39904282 c:\users\computers\39905798 c:\users\computers\39323227.zip c:\users\computers\39328635.zip c:\users\computers\39329113.zip c:\users\computers\39329288.zip c:\users\computers\39331075.zip c:\users\computers\39331386.zip c:\users\computers\39904282.zip c:\users\computers\39905

PHP Remove a string that starts with http:// or www and ends with .com/.ca/.net etc -

i found bunch of link show how delete within str_replace() want censor link on post. better, somehow detect when user trying post link , not let them submit form until remove it i not sure write inside str_replace() or how check page inserted urls any appreciated! you'll want check submitted string against regular expression using preg_match(). preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i", $string)

internationalization - CakePHP: Reload .po file after changing language -

i have change current language select system form submit selectbox ajax submit. so, when language changed, have return login labels change them javascript (specifically, username, password , login button labels). the problem that, although change language successfully, .po file loaded, return me previous language. this code: public function cambiar_idioma($idioma) { $this->session->write('login.language', $idioma); configure::write('config.language', $idioma); $this->set(array( 'usuariologin' => __("usuario"), 'usuariopassword' => __("contraseña"), 'login-button' => __("ingresar") )); $this->set('_serialize', array('usuariologin', 'usuariopassword', 'login-button')); } so, when change 'spa', set new language, .po files loaded, array return in english. , vice-versa. suppose have load .po files again b

minecraft - How to install Forge scr 1.6.2 -

Image
i changed lot of code within mod , switched make available minecraft 1.6.2. 1 of classes getting error on version (*made 1.5.2 , 1.6.2 - updated using 1.6.4). i cannot install forge keep getting 403 forbidden error. believe forge changed file names .stash , causing issues. i making mod available 1.6.2 request 1 of users. not having available version real disappointment meet everyones required needs. how install forge scr 1.6.2 (latest) without getting these errors: (i have been trying 3 days not coming here copy past solutions) try latest 1.6.4 version. minecraft changed location of resources , libraries, forge looking in wrong places now. last 1.6.4 uses old install system, if want can try new build system called forgegradle using 2nd last 1.6.4 version. idea way 1.7+. good luck! (p.s. if want stick 1.6.2, can snatch new locations 1.6.4 scripts)

html - Why does Chrome not redirect using meta refresh -

an application work has pl/sql package creates page , uses function create meta tags. it creates webpage meta tag : <meta http-equiv="refresh" name="refresh" content="1; url=paymentsubmit.html"> the problem chrome not name="refresh" attribute. not redirect page, although redirect in ie , firefox if remove name attribute, looks works in browsers : <meta http-equiv="refresh" content="1; url=paymentsubmit.html"> what's going on here? can't find w3c standard meta redirect, every browser make it's own rules ? i'm not sure if ever worked in chrome, since never heard bug reports assume used work in chrome. anyone have similar problem ? thanks if check the w3c wiki can find following quote: exactly 1 of name, http-equiv, , charset attributes must specified. it mean's not valid html both - name , http-equiv attributes set. read this w3c's html , xhtml te

php - auto publish custom post type when publish different post type -

i have wordpress music website based on soundcloud api, thing that, in website have 2 custom post types: albums , artists. im trying auto publish artist when publishing audio track. can info databse of artist using soundcloud api have no idea how can auto publish both of them @ same time. needed function check if artist published , if so, not publish again, there wont duplicates. should filtered artist id... it big time saver. great! tnx.

vba - How to detect the namespaces in a foreign XML document using MSXML2? -

when working xml using msxml2, it's pretty documented xpath queries work, need define selectionnamespaces property. however, straightforward fix if know namespaces are. i'm writing module in vba hope able use parse office xml formats, , i'd function can arbitrarily define namespaces documents load them. at present, i've found following isn't bad first stab: public dodefinenamespaces(strrootnodename string, strfilepath string, byref omydoc msxml2.domdocument60) dim orootnode msxml2.ixmldomnode dim omydoc msxml2.domdocument60 dim oattribute msxml2.ixmldomnode sim strnamespaces string set omydoc = new msxml2.domdocument60 omydoc.load strfilepath set orootnode = omydoc.selectnodes("./*[name()='" & strrootnodename & "']") each oattribute in orootnode.attributes if oattribute.namespace = "http://www.w3.org/2000/xmlns/" strnamespaces = strnamespaces & oattribute

how to give commands to the cmd through a windows 8 app in c# for wifi hotspot -

we planning develop wifi hotspot app in windows appstore using xaml , c# in visual studio. unable find class or methods access command prompt desktop. need type below code start hotspot connection using internet sharing in windows 8: netsh wlan set hostednetwork mode=allow ssid=connectionname key=8characters need have solution problem somehow through can send above commands command prompt , start connection using windows 8 app. please me. thank you. use system.diagnostics.process execute commands. sample code, copied verbatim documentation, modified needs: using system; using system.diagnostics; using system.componentmodel; namespace myprocesssample { class myprocess { public static void main() { process myprocess = new process(); try { myprocess.startinfo.useshellexecute = false; // can start process, helloworld do-nothing example. myprocess.startinfo.filen

java - ScrolledComposite: scroll bar is not showing when needed -

Image
i have ui looks below. what i'm trying here initialize whole ui in beginning , call relayout() method whenever user has filled input. problem here is, if content (the "name" here) takes more spaces, scroll bar supposed show , let user scroll can see data, scroll bar doesn't show @ all. protected void initializeframe() { setlayout(new filllayout()); maincomposite = new composite(this, swt.none); maincomposite.setbackground(getbackground()); gridlayout layout = new gridlayout(2, false); maincomposite.setlayout(layout); griddata data = new griddata(); data.horizontalalignment = griddata.fill; data.grabexcesshorizontalspace = true; data.horizontalspan = 2; headingcomposite = new composite(maincomposite, swt.border); headingcomposite.setbackground(getbackground()); headingcomposite.setlayoutdata(data); scrolledcomposite = new scrolledcomposite(maincomposite, swt.v_scroll| swt.h_scroll); scrolledcomposit

c++ - Does order matter when #defines are using other #defines? -

according answer this question , following code legit: #define 3 three #define 9 three*3 int main() { std::cout << nine; return 0; } and sure, compiles , runs fine. however, answer mentioned question states 1 should careful order of such #define directives, , 1 used in other #define s should defined before them. following code: #define 9 three*3 #define 3 three int main() { std::cout << nine; return 0; } also compiles , runs fine, , prints "9". is compiler letting me off easy, or order indeed not matter #defines use other #define s? compilation fail on more complicated project? one thing worth mentioning mentioned question speaks of c , whilst code in c++. (supposed) differences in behavior come from? three macro need defined before use of nine macro. can change three before every use of nine : #define 9 three*3 #define 3 three int main() { std::cout << nine; //9 #undef 3 #define 3 4 std::cout <&l

ruby - Rails: purpose of downloading gems locally -

generally, if need gem, put in gemfile , bundle install. however, don't understand if there benefit downloading gems locally first gem install _____ . there benefit this? bundle install no longer have connect net in situation? bundler installs gems located in gemfile locally same if ran gem install each of gems.

android - Submitting double values to Google Play service's LeaderBoard -

well , want submit value double leaderboard in google play service says submit method "long value" games.leaderboards.submitscore void com.google.android.gms.games.leaderboard.leaderboards.submitscore(googleapiclient arg0, string arg1, long arg2 ) so how how can submit double or float values? for both double , float , can cast on long this: long arg2 = (long) yourdoubleorfloat; however, keep in mind both double , float unprecise, floating point numbers. may want using int 's.

ios - Finding a desired point based on an objects velocity and rotation -

i'm looking find point 200 pixels in front of enemy object. method try calculate point this: //all sprites start facing down, begin point 200 pixels infront of sprite current pos -200 on y axis. cgpoint predictedpoint = cgpointmake(self.position.x, self.position.y - 200); //get direction of vector current position. predictedpoint = [utilities minusvector:predictedpoint vector2:self.position]; predictedpoint = [utilities cgpointnormalize:predictedpoint]; //multiply 200 200 pixels ahead. predictedpoint = [utilities multiplyvector:predictedpoint scalar:200]; //work out way rotate enemy based on velocity. (this code works enemies face way move!) cgpoint facingvector = [utilities minusvector:self.position vector2:cgpointmake(self.position.x + self.velocity.x, self.position.y + self.velocity.y)]; float theta = (atan2f(facingvector.y, facingvector.x) - sk_degrees_to_radians(90.0f)); //rotate float cs = cosf(theta); float sn = sinf(theta); float px = predictedpoint.x * cs - pred

c++ - pthread and multicore on windows -

my question relates pthread library , making use of multicore system. system seems improve under proper parameters , small data sizes, improvement being around 65000. data suggests when increase threads begins decrease time takes increases shortly afterward. when thread number = 1,2,4 might increase , 8, 16 time begins decreasing again. in large data sizes there no improvement , times remain close together. if tell me if forcing threads act sequentially or issue awesome. heres data 1395525080 0 num thread: 1 data size: 1024 0 1395525080 1395525080 0 num thread: 2 data size: 1024 0 1395525080 1395525080 0 num thread: 4 data size: 1024 0 1395525080 1395525080 15 num thread: 8 data size: 1024 0 1395525080 1395525080 47 num thread: 16 data size: 1024 0 1395525080 1395525080 31 num thread: 32 data size: 1024 0 1395525080 1395525080 16 num thread: 1 data size: 4096 0 1395525080 1395525080 0 num thread: 2 data size: 4096 0 1395525080 1395525080 0 num thread: 4 data size: 4096 0 13955

Dart is too fast -

i'm trying understand why code print "check" twice... import 'dart:io'; import 'dart:async'; import 'dart:convert'; future<map> ft_get_data() { file data; data = new file("data.json"); return data.exists().then((value) { if (!value) { print("data no exist...\ncreating file..."); data.createsync(); print("filling it..."); data.openwrite().write('{"index":{"content":"helllo"}}'); print("operation finish"); } }).then((_) => data.readasstring()).then((content) => json.decode(content) ).catcherror((e) => new map()); } void main() { map params; string name; num check = 0; httpserver.bind('127.0.0.1', 8080).then((server) { print("server lauching... $server"); server.listen((httprequest request) { request.response.statuscode = httpstatus.accepted; request.res

Android lifecycle - are my ideas correct? -

i have read android life cycle in couple of books , official documentation, still unable thoughts in 1 place , understand completely. developing simple app, in use fragments, makes harder, fragments have separate life cycle applications. ask couple of questions: my application simple logger of various data, user needs enter data , @ it. understand, cycles onpause, onresume, onstop shouldn't worry about? guess real question android life cycle methods essential every application? is considered bad practice if (fragment vise) calling methods , managing views in oncreateview? do know simple , yet guides me understand how manage android life cycle correctly? onresume , onpause important part of lifecycle, , should worry it. whenever user change app another, o goes notifications, or whatever, calling onpause() when goes app, , onresume() when came back. have understand activity may killed, (if system don't have enough resources), in case oncreate called first, if n

css - Image fit to window -

i wanted fit image (galeria.jpg) window adds scrolling panel @ bottom , border on menu. shouldn't go this... html code: <body> <div class="tlo"> <div class="logo"> <img src="logo.jpg" /> </div> </div> <div class="galeria" > <img src="galeria.jpg" /> </div> <div class="menu"> <ul> <li><a href="link">strona gŁÓwna</a></li> <li><a href="link">kontakt lokalizacja</a></li> <li><a href="link">zakres czynnoŚci notariusza</a></li> <li><a href="link">opŁaty w kancelarii</a></li> <li><a href="link">przydatne informacje</a></li> </ul> </div> </body> css: body { background-color:#ffffff; padding:0p

python - Extract numbers with EXPONENTS from heterogeneous text file -

i need take out unformatted numerical data text file. in textfile, numbers somewhere separated single space , somewhere multiple spaces, somewhere tabs; pretty heterogeneous text :( want python ignore spaces/tabs , identify whole numerical values , put them in array/list. possible using python? edit: there many numbers written in scientific/exponential notation e.g. 1.2345e+06 , , python not recognize them numbers. \d not work :( i don't want use normal string search purpose (given there many strings/words of no interest/use). regular expression module documentation has nothing mentioned issue. if lines " 2.3e4 " or "2.6" or so, try: ^\s*?([+-]?\d+(\.\d+)?(e[+-]?\d+)?)\s*$ notice \s*? mark (non-greedy zero/more spaces). dont forget question mark there - not including question mark make capture last digit of number due greediness. afaik python has not special symbol, other \d digits, capture numbers

android - Is Google Account required for GCM (Google Cloud Messaging)? -

i need write simple app push notifications. used gcm uses google play services information. my questions - access gcm, google account required or not? can use email account identify device? there other way push notification email account or device? quoting gcm characteristics it uses existing connection google services. pre-3.0 devices, requires users set google account on mobile devices. google account not requirement on devices running android 4.0.4 or higher. if app supporting pre-3.0 devices, yes , google account required , need add permission manifest <uses-permission android:name="android.permission.get_accounts" />

php - is it possible to use * in query for $stmt->prepare($query)? -

i know might noob question. still newbie in php specially in using mysqli. is possible use * in query $stmt->prepare() , using bind_result()? example have select 50 columns in 1 table conditions parameter cause if type 50 columns take time. in scenario how can result? $stmt->prepare("select * table col1 = ? , col2=? , col3=? , col4=?") $stmt->bind_param("ssss",$col1, $col2, $col3, $col4) $stmt->execute() thanks. appreciate help. yes, of course. use $res = $stmt->get_result() followed familiar $row = $res->fetch_assoc() stuff however, newbie, indeed strictly advised choose pdo on mysqli.

eclipse - How to add to git index with JBoss Tools -

i've created new project on openshift , cloned locally. i'm having problems adding new files , folders git index. right click on new folder (with files , subfolders) in project explorer , choosing team -> add index, changes nothing. , if try commit, eclipse says there aren't changes... (if update existing files, seems fine). what problem? make sure have "git staging" view open, , right click on file in unstaged changes , select "add index", make sure file not empty, did not show staged file until after added content it, after had added file. (can't add empty files or directories git egit maybe?)

simplepie throwing up error messages on site -

i have had simplepie feed on website number of years. of sudden throwing lot of errors. see page see mean: http://flowers-lincoln.co.uk/florist-shop-lincoln.php . know if issue depreciated code? webhosting company taken over, site has moved servers - i'm wondering if may have caused issue. guidance appreciated. many vicky i'm answering own question in case else runs similar issue. the problem caused php upgrade on our hosting server. added script ini_set('display_errors','0'); and fixed problem.

bash - How to set my regex to return in only one line? -

my input information can be: "abc1-abc-ab-0/1/2" or "abc1-abc-0/1/2". need return variable in 1 line. in regex code, i'm gettint 2 lines of maches. can me? [root@server]# echo "abc1-abc-ab-0/3/7" | grep -op '^(([a-za-z0-1]){4})-(([a-za-z]){3})|-(([a-za-z]){2})' abc1-abc -ab two ways collect output of command on 1 line: echo $( command ) command | xargs echo

Drupal 7 - Fivestar and Userpoints -

i have content type , possibility logged in users vote on it. there 5 different fivestar votings (categories) on node. want add userpoints , wanted ask if possible when user votes gets 1 point every vote on node, 5 points if votes in every category. has possibility change vote later, shouldn´t points anymore. possible? greets while doesn't there existing 7.x or 8.x module accomplishes this, there 2 ways should able accomplish goal: write module. userpoints api well-documented , should possible create module increment user's userpoint count when fivestar field modified. avoid duplication, note field looks should accomplish de-duping looking (assuming set txn_id combination of current node id, field id, , user id: 'txn_id' => (int) transaction id of current points record. if present update occurs use rules. userpoints module integrates rules, should able accomplish userpoints use case without writing code. accor

How to combine these 2 small tablesorter scripts -

i have jquery tablesorter script, , trying add these 2 functions together. seems simple, though unfortunately have little knowledge javascript. it work when have 1 or other in , not have below. <script type="text/javascript"> $(document).ready(function(){ $(function() { $("table").tablesorter({ sortlist:[[0,0]] }); }); }); $(document).ready(function(){ $("table").tablesorter({ textextraction:function(s){ if($(s).find('img').length == 0) return $(s).text(); return $(s).find('img').attr('alt'); } }); }); </script> try do: <script type="text/javascript"> $(document).ready(function () { $("table").tablesorter({ sortlist: [ [0, 0] ], textextraction: function (s) { if ($(s).find('img').length == 0) return $(s).text(); return $(s).fin

How to communicate with Firefox using C++? -

i on project right simple parental control software, but, want know url requested in firefox take respond based on ... if may because don't know how let software know url requested firefox .. how that? have use c++ in of software.. if there better language task please advice me in firefox need use xpcom component called nsihttpchannel. script below block abort rqeuests google. channel opened aborted before opening connection server. var {classes: cc, results: cr, utils: cu} = components; cu.import('resource://gre/modules/services.jsm'); var httprequestobserver = { observe: function(subject, topic, data) { var httpchannel, requesturl; if (topic == 'http-on-modify-request') { httpchannel = subject.queryinterface(ci.nsihttpchannel); requesturl = httpchannel.uri.spec; if (/google\.com/.test(requesturl)) { httpchanel.cancel(cr.ns_binding_aborted); } ret

c# - MonoDevelop changes my code -

i using monodevelop every time when hit enter of tab or space, mono develop changes text. add tabs or change word (if -> ienumerable) or add new lines. i sure has name have no idea, sorry. can turn off? tools > options > in text editor section general > turn off code completion.

java - Get Maven's module classpath at runtime -

i wan run java app in different process, , use classpath of maven module. how can that? try stuff: string separator = system.getproperty("file.separator"); string path = system.getproperty("java.home") + separator + "bin" + separator + "java"; processbuilder processbuilder = new processbuilder( path, "-cp", //system.getproperty("java.class.path"), ".." + separator + nodeproperties.getclasspath(), nodeproperties.getmainclass()); processbuilder.directory(new file(".." + separator + nodeproperties.getworkingdir())); map<string, string> env = processbuilder.environment(); env.put("jmx-port", "8000"); env.put("mode", "super_peer"); processbuilder.inheritio(); try { process process

c++ - order of constructor execution -

does code expect do? meaning, handle_(curl_easy_init()) part called before or after constructor body execution? class oauth2 { public: oauth2() : handle_(curl_easy_init()) { if (handle_ == null) { throw new runtime_error("curl_easy_init return null"); } } ~oauth2() { curl_easy_cleanup(handle_); } private: curl * handle_; }; thanks is handle_(curl_easy_init()) part called before or after constructor body execution? it called before execution of constructor body. c++ standard n3337 § 12.6.2.10: initializing bases , members in non-delegating constructor, initialization proceeds in following order: — first, , constructor of derived class (1.8), virtual base classes initialized in order appear on depth-first left-to-right traversal of directed acyclic graph of base classes, “left-to-right” order of appearance of base classes in derived class base-specifier-list. — t

jsp - Use column names with periods -

i've been writing jsp insert values excel sheet , code below. <%@page import="java.sql.*"%> <% connection con = null; statement stmnt = null; try { int updatequery=0; string a=request.getparameter("comments"); string b=request.getparameter("updatedl"); string c=request.getparameter("sid"); string d=request.getparameter("desc"); string e=request.getparameter("pubcode"); string f=request.getparameter("type"); string g=request.getparameter("status"); string h=request.getparameter("daterec"); string i=request.getparameter("startd"); string j=request.getparameter("assignedd"); string k=request.getparameter("senttoae"); string l=request.getparameter("respfrmae"); string m=request.getparameter("vwrcmp"); string n=request.getparameter("ps"); string o=request.getpar

arrays - How to use System.in.read() in java? -

i need input , load chars in boolean 2-d array. if char x , mark array element true ; else if char . , mark array element false. here design: boolean[][] array = new boolean[2][2]; (int = 0; < 2; i++) { (int j = 0; j < 2; j++) { if (system.in.read() == '.') { array[i][j] = false; } else if (system.in.read() == 'x') { array[i][j] = true; } } } and, example, if type in .... or xxxx , not produce correct result. other input result not correct. so how deal this? you reading character second time in loop if first character not '.' . you should read 1 character per loop. save character in variable before if statement, , compare variable '.' , 'x' in turn.

sql server - SQL Need two WHERE clause conditions -

i need conditional where clause or case statement based on table field's value. this have , it's not working: select n.id, n.message, n.type notifications n ( n.type = 1 , applicationmask & isnull(@applicationmask,2147483647)<> 0 , cast(getdate() date) between cast(startdate date) , cast(enddate date) , not exists(select notificationid notificationdelivery nd nd.notificationid = n.id , nd.userid = @userid) ) or ( n.type = 2 , applicationmask & isnull(@applicationmask,2147483647) <> 0 , cast(getdate() date) between cast(startdate date) , cast(enddate date) ) the or messing up, think. top where clause works itself, returning rows should not return. seems not exist part being ignored. there better way? not strong in sql queries.

C, variadic functions and stdarg.h -

i found code on codegolf.stackexchange site. #include <stdio.h> #define function int #define var int struct { int (*log)(const char *,...); } console = { printf }; /* here on javascript! */ function fac(x){ if(x < 2) return 1; return x * fac(x - 1); } function main(){ console.log("hello world!\n"); for(var = 0; < 10; i++){ console.log("%i! = %i\n", i, fac(i)); } return 0; } // *should* export main function of library??/ exports.main = main; my question is, how able run variadic function without including stdarg.h? because not manipulating ... parameter, passing pointer function internally manipulates ... parameter, in case printf: int __cdecl printf(const char *_format, ...); note: not compilers support __cdecl calling convention. aswell, macros has defined pointless , should not used under circumstance, not c.

c++ - Segfault when imbueing stringstream with custom locale -

based on answers here question of how format numbers comma, using following code: #include <locale> #include <stringstream> namespace { class comma_numpunct : public std::numpunct<char> { protected: virtual char do_thousands_sep() const { return ','; } virtual std::string do_grouping() const { return "\03"; } }; } /* convert number string using comma thousands separator. */ string thousands(const int x) { /* custom locale ensure thousands separator comma */ comma_numpunct* comma_numpunct_ptr = new comma_numpunct(); std::locale comma_locale(std::locale(), comma_numpunct_ptr); stringstream ss; ss.imbue(comma_locale); // apply locale stringstream ss << x; /* garbage collection */ delete comma_numpunct_ptr; return ss.str(); } gdb gives following backtrace: program received signal sigsegv, segmentation fault. 0x0000000000000021 in ?? () (gdb) bt #0 0x

php - Multi-dimensional array from SQL query -

i have multi-dimensional array trying build sql query. having trouble adding id in inner array. code: $checkboxes = "select id, name review_sites active=1 order name asc"; $result = mysql_query($checkboxes) or die(mysql_error()); $names = array(); while ($row = mysql_fetch_array($result)) { $names[]['name'] = $row['name']; } currently array looks like: array ( [0] => array ( [name] => 411.ca ) [1] => array ( [name] => automd ) i need array this: array ( [0] => array ( [id] => 4 [name] => 411.ca ) [1] => array ( [id] => 9 [name] => automd ) you selecting id , name in query so, in loop: while ($row = mysql_fetch_assoc($result)) { $names[] = $row; } or simply: while ($names[] = mysql_fetch_assoc($result)) {} notice, mysql_fetch_assoc() return associative array. mysql_fetch_array() returns associative , n

javascript - WebRTC works locally, but not across different IP addresses -

my code on github at: https://github.com/rashadrussell/webrtc_experiment/blob/master/public/script.js i trying write 1-to-1 video video conferencing script webrtc. , being stored on appfog, cloud hosting website. works on localhost when test 2 different chrome windows on single computer. works on appfog when test on 2 different computers @ home. the problem occurs when test app friend living @ different house. remote streams not being set. guess there error ip addresses, means wrong setup of ice candidates. pops black box remote stream supposed be. here of code: **client-side** var isinitiator = false; socket.on('initiatorfound', function(data) { isinitiator = data.setinitiator; console.log("is initiator? " + isinitiator); }); navigator.getmedia = ( navigator.getusermedia || navigator.webkitgetusermedia || navigator.mozgetusermedia || navigator.msgetusermedia ); navigator.getmedia( {video: true, audio:

php - Can this query be bypassed by an injection? -

$username = mysql_real_escape_string($_post['username']); $password = mysql_real_escape_string($_post['password']); $checkpassword = mysql_query("select * user_info username='$username' , password='$password';"); can query bypassed injection , if able craft injection can use security testing? i have tried doing 'x' or 1=1 mysql_real_escape_string manages remove quotes , treats whole field string. thank in advance. the whole purpose of mysql_real_escape_string escape value passed safely used in mysql string literal . , use value escaped mysql_real_escape_string how it’s supposed be, i. e., in string literals, have done correctly. so there no way bypass long have set connection character set properly there case mysql_real_escape_string still may bypassed due improper setting of connection character set when using character sets gbk or big5 .

Difference between a stripped binary and a non stripped binary in Linux -

could please explain me whats actual difference between stripped , non-stripped binary in linux ? after little bit of googling, found non-stripped binary contains debugging info , stripped binary does'nt. although have found answer google. putting , non-stripped binaries have debugging information built it. if compile executable gcc's -g flag, contains debugging information. whereas strip binaries remove debugging information exe not necessary execution reduce size of exe.