Posts

Showing posts from February, 2013

listview - select from parse not show the values in list view android -

Image
i have code onlt select parse data, afer succedd wish show data in view made it, when set text views shows in app : this code : protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_sharing_board); parse.initialize(this, "******", "******"); //set listview arraylist<string> sharinglist = new arraylist<string>(); //create , populate arraylist of objects parse listadapter = new arrayadapter<view>(this, android.r.layout.simple_list_item_1); listview sharinglistview = (listview)findviewbyid(r.id.listview1); sharinglistview.setadapter(listadapter); final parsequery query = new parsequery("sharingboard"); inflater = (layoutinflater)this.getsystemservice(context.layout_inflater_service); query.findinbackground(new findcallback<parseobject>() { public void done(list<parseobject> objects, parse...

node.js - nodejs version issue when installing express -

just setting raspberry pi node.js server. did clean install of raspberian then installed node if node -v says: v0.10.25 then installed npm if npm --version says: 1.1.4 if npm install express fails , reason why says npm err! required: {"node":">= 0.8.0"} npm err! actual: {"npm":"1.1.4","node":"0.6.19"} any idea doing wrong? i used manual , version 0.11.3 , got success. http://doctorbin.tumblr.com/post/53991508909/how-to-install-the-latest-version-of-nodejs-npm-and

Simple Javascript for form validation doesn't work -

so, have written form , simple javascript validate user input. thing is, works until add third function, validatehash, takes hashtag inputed textbox , checks if has hashtag @ beginning. sent code friend, , said on pc works fine (checks if fields filled, , checks if hashtag correct), while on mine skips every function , submits data php page without checking anything. using firefox, , he's using chrome, tried latter same results. there wrong in code itself? <!doctype html> <meta charset="utf-8"> <link rel="stylesheet" href="style.css" /> <script language="javascript" type="text/javascript"> function validateform() { if(validate(document.form.song.value) && validate(document.form.hashtag.value)) if(validatehash(document.form.hashtag.value)) return true; else { alert("please fill fields"); return false; } } function validate(text) { if(...

Links Selection Not Working in Using jQuery in Joomla Module -

good day everyone. i'm building joomla module , trying collect links using following menulinks = jquery('.menu .menu_items .menu_item a') problem menulinks empty (i confirmed menulinks.length). worked fine when used outside joomla using html , javascript. a quick appreciated, thanks! finally found helped: jquery('div').find('.megamenu .menu .menu_items .menu_item a').each(function() { count++; console.log(count); }); this should trick: $(document).ready(function() { $('.menu .menu_items .menu_item').find('a').each(function() { var self = $(this); console.log(self.attr('href')); }); }); if check console, see shows links each menu item. hope helps

powershell - Renaming files with string extracted from filename -

i have following code in powershell script: #call bluezone file transfer #start-process "\\fhnsrv01\home\aborgetti\documentation\projects\automation\openbz.bat" #variable declarations $a = get-date $b = $a.tostring('mmddyy') $source = "\\fhnsrv01\home\aborgetti\documentation\stage\" $dest = "\\fhnsrv01\home\aborgetti\documentation\stage\orig" #find files have ediprod extension , proceed process them #first copy original file orig folder before manipulation takes place copy-item $source\*.ediprod $dest # must rename items in table switch(gci \\fhnsrv01\home\aborgetti\documentation\stage\*.ediprod){ {(gc $_|select -first 1).substring(176) -match "^834"}{$_ | rename-item -newname {"834dailyin$b"};continue} {(gc $_|select -first 1).substring(176) -match "^820"}{$_ | rename-item -newname {"820dailyin$b"};continue} } the part i'm concerned here: switch(gci \\fhnsrv01\home\aborgetti\documentati...

Working with Meteor and Async balanced-payments functions -

i'm using balanced-payments , version 1.1 of balanced.js within meteor. i'm trying create new customer using balanced.marketplace.customers.create(formdata); here checkformsubmitevents.js file template.checkformsubmit.events({ 'submit form': function (e, tmpl) { e.preventdefault(); var recurringstatus = $(e.target).find('[name=is_recurring]').is(':checked'); var checkform = { name: $(e.target).find('[name=name]').val(), account_number: $(e.target).find('[name=account_number]').val(), routing_number: $(e.target).find('[name=routing_number]').val(), recurring: { is_recurring: recurringstatus }, created_at: new date } checkform._id = donations.insert(checkform); meteor.call("balancedcardcreate", checkform, function(error, result) { console.log(result); // successful ...

visual c++ - How do I disable warning 4355 globally in MSVC project? -

i want disable warning 4355 globally in msvc c++ project. 1 solution write #pragma warning(default:4355) in prefix.h and #include prefix.h source files. possible disable warning in project options? menu: project - properties - configuration properties - c/c++ - advanced - disable specific warnings. type 4355. if need disable several warnings, use semi-colon delimiter.

ruby - Converting a Postgres query to Rails ActiveRecord? -

is possible write following query in rail's activerecord format? i've tried billion different ways arel can't same results. select topic_id, count(*) total questions_topics question_id in ( select id questions user_id = 1000 union select questions.id questions join answers on (questions.id = answers.question_id) answers.user_id = 1000 ) group topic_id order total desc; well, should work. not same thing should give same results. questiontopic.where( "question_id in (?) or question_id in (?)", question.where(user_id: 1000).select(:id), answer.where(user_id: 1000).select(:question_id) ).group('topic_id') .order('total desc') .select('topic_id, count(*) total')

Integrating R into Excel 2013 using VBA -

this question has answer here: running r scripts vba 2 answers embed r process in vba macro 3 answers i'm playing wordclouds in r, drawing data column in excel 2013. had been doing going in excel doc, copying respective column , dumping via clipboard r. there tricky areas involving pivots in excel doc , i'd push wordcloud functionality excel. i've been told 1 way run r script through vba on excel. knowledge of vba beyond poor, however. r script below: library("tm") library("wordcloud") library("snowballc") clipboard <- read.table("clipboard",sep="\t",header=t) vclip <- as.vector(clipboard) words <- corpus(vectorsource(vclip)) words <- tm_map(words, stripwhitespace) words <- tm_map(words, tolower)...

ios7 - SpriteKit scene/node on top a paused scene -

i'm trying add scene/node on top of paused scene transparent background active scene view still visible. i pause scene scene.view.paused = yes; means paused update method. with cocos2d 1 push new scene on top of existing 1 unfortunately spritekit not have capability. is there way pause scene , add active scene/node on top of ? a solution i've tried : creating additional view controller pause-scene content , present via active view controller when needed background black transparency not achieved , other problems occur original scene (i'll elaborate on these if needed). it's there. not have present new scene or view. in nutshell: pause node game content on want pause. if processing in scene class you'll have refactor it, i'm afraid. key having sknode acts "game layer" can pause particular node. if receive update: , other regular method calls game layer, should check self.paused state before doing processing. when have tha...

google apps script - Copy content from one spreadsheet to another without IMPORTRANGE -

i'm trying create bidirectional sync of content between 2 google spreadsheets. my script working when: the source , destination id of sheets same , have id of active spreadsheet so, works: function myfunction() { var sourcespreadsheet = spreadsheetapp.openbyid("id-of-active-spreadsheet"); var destinationspreadsheet = spreadsheetapp.openbyid("id-of-active-spreadsheet"); var sourcesheet = sourcespreadsheet.getsheetbyname("sheet1"); var destinationsheet = destinationspreadsheet.getsheetbyname("sheet2"); var sourcerange = sourcesheet.getrange("a1:a4"); // destination, columnstart, columnend, rowstart, rowend sourcerange.copyvaluestorange(destinationsheet, 2, 2, 3, 7); } but when replace destination id id of spreadsheet, doesn't work. have permissions? have tried publish both spreadsheets. this doesn't: ... var sourcespreadsheet = spreadsheetapp.openbyid("id-of-active-spreadsheet"); va...

express - Anyway to implement Meteor like data subscription in Node.js -

i using express.js 1 of projects, basically, trying achieve simple: the page displays list of entries pulled data mongodb collection when user adds new entry, client side jquery collects input , fires ajax call server script server code adds data mongodb collection server signals client re-render templating code hence list updated where having problem #4, mentioned, client re-render template updated data, instead of manipulating dom using jquery. i have tried using socket.io, using .ajax, plus have pass res variable around can res.render mess... with meteor.js, data hot push (subscription) done automatically, there must way express.js, right? has done before? please!!! without work run meteor server following: /server/main.js collectionname = new meteor.collection("collectionname"); meteor.publish("some_name", function() { return collectionname.find(); }); then have simple nodejs app npm install ddp app.js var ddpclien...

Python Permutation with Limits and Directionality -

so have problem can't head around, can give pseudocode @ best. lista=(a,b,c) listb=(a1,b1,c1,d1,a2,b2,c2,d2,a3,b3,c3,d3) i need way limit results of permutations of listsb following criteria: a tuple of items contained in lista the order of lista needs retained the permutations can right lista , list b can length for example: acceptable: a1,b1,c1 a2,b3,c3 unacceptable: a1,b1,d1 a2,b1,c3 b2,a2,c3 any ideas have appreciated! thanks i'm not sure calling "permutations", since seems want one-of-each combination. probably straightforward write own recursive generator. used string operations , startswith determine association between lista , listb ; can want if have different objects. lista=('a','b','c') listb=('a1','b1','c1','d1','a2','b2','c2','d2','a3','b3','c3','d3') def gen_combos(li, keepers, builder=tuple...

fopen - C programming - Open file with variable name -

i have lot of folders, , in each folder there lot of files, sequence of folders , files starts 0 till 100 etc.. i'm trying open each file using loop read what's in file, i'm getting error file pointer null. please help for(int folder=0; folder<100; folder++) { if(flag == 1) break; for(int file=filenumber; file<=filenumber; file++) { char address[100] = {'\0'}; sprintf(address,"/volumes/partition 2/data structure/tags/%d/%d.txt",folder,filenumber); files=fopen(address,"r"); if(files == null) { printf("error opening file!\n"); flag = 1; break; } } } gwyn evans has answer pegged in comments, give him credit if provides answer, have 2 issues: you're starting second loop filenumber , instead of 0 ; and you not writing correct filename address , since you're using filenumber when should using file . t...

remote server - Plotting remotely using mayavi and python -

i have massive file need parse , render on remote machine, have scripts written using mayavi this. i'd save image png , copy image on , view locally. pretty simple matplotlib setting backend 'agg', i'm having serious problems doing mayavi. i've followed guide here http://docs.enthought.com/mayavi/mayavi/tips.html but problem importing mlab alone requires access xdisplay, can't turn on virtual window suggested. to reproduce this, access machine through ssh , run simple python script like: #!/usr/bin/python mayavi import mlab and error out standard; unable access x display, $display set properly? if has fix this, or alternative route rendering 3d image remotely i'd appreciate it. 3d rendering provided matplotlib insufficient need suggestions working alternatives mayavi appreciated well. if on *nix platform running x server, use solution in documentation under rendering using virtual framebuffer dpinte commented above. have ...

shell - How do you get a count of the occurrence of a word in each of a large set of files in Unix? -

i trying frequency of particular word in several files. wrote in unix shell: find . -name "*.out" | xargs grep -i "search_string" | wc -l the problem giving me sum of frequencies of document. want individual counts each file. best way shell? find . -name '*. out' -exec grep -ci "search_string" {} +

How to comment a block of statements in inno setup -

i using inno 5.5.4(u) setup. please let me know how comment/uncomment block of statements @ time using keyboard shortcut keys. thank you. to comment block of code use { commented code } or (* comment *) or mean different??

Android push message issue, getting old message always on display screen -

please me out. stuck gcm push message. working perfect when trying display message on next screen getting old 1 or first one. if check log cat, getting new message server. problem not getting. have tried many code on stackoverflow. here snippet of code- // service class public class gcmintentservice extends gcmbaseintentservice { public gcmintentservice() { super(sender_id); } // onmessage revive method @override protected void onmessage(context context, intent intent) { log.i(tag, "new message= "); string message = intent.getextras().getstring("message"); generatenotification(context, message); system.out.println(message+"++++++++++1"); } // notification method private void generatenotification(context context, string message) { system.out.println(message+"++++++++++2"); int icon = r.drawable.ic_launcher; long when = system.currenttimemillis(); ...

rspec - Test if a method is called by an object -

i new rspec , rails. want test execute method won't called if run method not run confirm true. how should write rspec test? class release def run(confirm=false) execute if confirm end def execute # end end it "should not execute without confirmation" release = release.new release.run expect(release).not_to have_received(:execute) end

node.js - node webkit installer for a single user -

i have created software using nodejs , express, packaged , created executable using node-webkit. deliver file client. problem if client copy files , put on computer, can still use app. how create exe file using node-webkit 1 pc? you can use physical address of computer var expectedmacaddress = '', currentsystemmacaddress = ''; if ( expectedmacaddress == currentsystemmacaddress ){ // continue running app } else { // exit app. display limited license warning }

python - How to omit some values in an array -

this question has answer here: choose m evenly spaced elements sequence of length n 4 answers i have vector vec -it's length 1774. , need make vector n of length 10 contain 10 numbers of vec similar step like: n=[0, 178, 356, 534, 712, 890, 1068, 1246, 1424, 1602] first , last numbers not have same in vec . try: # -*- coding: cp1250 -*- __future__ import division newlength=10 vec=range(1774) step=round(len(vec)/newlength); n=range(0,len(vec),int(step)) print n print len(n) but results vector of length 11. when set newlength=22 22. problem of rounding (i tried math.ceil , math.floor-it works newlength=10 not newlength=554). there other way how vector n ? thanks think this: you have 1774 apples. you want split apples 554 equally sized groups. the group size must 1774/554 = 3.261. you round group size down , 3. you 1774//3 = 591 group...

Restkit post with core data entities and relationship -

i trying post contents of entity(articles) , relationship(authors) restkit object mapping. articles <->> authors article can have many authors. my current object mapping below, rkobjectmapping *authormapping = [rkobjectmapping requestmapping]; [authormapping addattributemappingsfromarray:@[@"name",@"email"]]; rkobjectmapping *articlemapping = [rkobjectmapping requestmapping]; [articlemapping addattributemappingsfromarray:@[@"title",@"body",@"date"]]; rkrelationshipmapping * rel =[rkrelationshipmapping relationshipmappingfromkeypath:@"author" tokeypath:@"author" withmapping:authormapping]; [articlemapping addpropertymapping:rel]; rkobjectmapping *mapping = [rkobjectmapping requestmapping]; [mapping addpropertymapping:[rkrelationshipmapping relationshipmappingfromkeypath:@"singlearticle" tokeypath:@"singlearticle" withmapping:articlemapping]]; for ...

javascript - How to send Json data and textbox data through jQuery ajax -

i have json collection , want send 1 textbox value controller through jquery ajax $('#btnsave').click(function (e) { debugger; $.ajax({ type: "post", url: '/asset/saveassociate', data: "{'data':'"+json.stringify(allvals)+"'}", contenttype: "application/json; charset=utf-8", datatype: "json", success: function (data) { alert(data); // var gridk = $("#grid1").data("kendogrid"); // gridk.datasource.read(); } }) }) and textbox value var _assetid = $("#assetid").val().trim(); like data: { json , assetid :assetid } can pass this this action method [nocache] public actionresult saveassociate(string data, string assetid) { javascriptserializer json = new javascriptserializer(); list<getuserdata> myobjs = new list<getuserdata>(); ...

javascript - hyphen not allowed in script src=? -

i thought cgi-bin place store js script, it's not found using <script type="text/javascript" src="cgi-bin/jscripts1.js"></script> renaming , changing cgi-bin cgibin makes work. documented somewhere? thought hypen most-accepted special character. i tested out code on local apache server. code works fine. problem seems hosted server (hostmonster) have mentioned in comments. an alternative using hypen encode in url shown. <script type="text/javascript" src="cgi%2dbin/jscripts1.js"></script> also check following links : html: href syntax : okay have space in file name https://github.com/bhauman/lein-figwheel/issues/5 https://github.com/emezeske/lein-cljsbuild/issues/260

jquery - Javascript - indexOf not so specific -

there way lower sensibility of indexof? this var arr = ["hello", "stackoverflow"] var idx = arr.indexof("stack") and idx = 1 instead of idx = -1 you'd have write own function that. work: function searcharr(arr, str) { (var i=0;i<arr.length;i++) { if (arr[i].indexof(str) !== -1) return i; } return -1; } searcharr(arr, 'stack');// returns 1 that iterates through array enter first argument, , keeps going until finds index array's value @ index contains search string.

android - Apportable SKTextureAtlas atlasNamed Failure -

i'm working on converting spritekit made, objective-c app android app through apportable. on 'apportable load', i'm running issues sktextureatlas. [sktextureatlas atlasnamed:atlas_name_constant] gives nil when running on android, doesn't when running on iphone. are there particular work-arounds texture atlas work nicely apportable, or going stuck using regular images? thanks in advance! unfortunately, our spritekit hacked-together-over-a-weekend implementation. if it's working regular images, i'd recommend keeping way. internally, we're considering how can better support spritekit in future--look notes in future sdk releases.

Are there small registers in ARM assembly? -

i started playing arm assembly , notice seem move 32 bit values registers if wanted move 8 or 16 bits registers in x86 assembly. i.e. arm eor r0, r0 mov r0, #128 x86 xor eax, eax mov al, 0x80 r0 contains 0x80 32 bit register contain 0x00000080 if x86 use al (8 bit register) manipulate last byte instead of eax (32 bit register). tl;dr there small registers in arm assembly? no. arm registers 32-bit 1 . however, assuming you're on recent enough architecture version (armv6t2 or later) can use bfi , ubfx instructions insert/extract arbitrary slice of register from/to bottom of without affecting other bits. doing same immediate operand little trickier since mov zero-extends immediates 2 (i.e. eor r0,r0 in example entirely redundant) - you'd either have use and , orr mentioned, or use intermediate register mov followed bfi . [1] well, "fixed-size" more appropriate once consider aarch64 state - there have 32-bit , 64-bit views of same regi...

android - Get values in a JSONArray -

hey have json array [ { "id": 1, "productname": "audi r8", "description": "the best of audi", "cost": 1000000, "rrp": 1500000, "product_category": [ { "id": 1, "category": { "id": 1, "categoryname": "supercars" } }, { "id": 2, "category": { "id": 2, "categoryname": "sportscars" } } ] }, { "id": 2, "productname": "nissan g-tr", "description": "the best of nissan", "cost": 950000, "rrp": 1000000, "...

html5 - Change image of an object -

i want make when run function changes image of objects in function , thought work for(var = 0; < heads.length; i++){heads[i].src = ram_head;} with ram_head equaling string url when run code image not change @ when run function. example of code: http://jsfiddle.net/themagicalcake/urva7 here's code that: creates array of image objects (heads) assigns same image url of image objects (rams_head) and when each image has loaded draws image canvas. example code , demo: http://jsfiddle.net/m1erickson/5dxe7/ var ram_head="https://dl.dropboxusercontent.com/u/139992952/multple/ramdisegno.jpg"; var heads=[]; heads.push(new image()); heads.push(new image()); for(var i=0;i<heads.length;i++){ heads[i].onload=function(){ ctx.drawimage(this,this.x,10); } heads[i].x=i*100; heads[i].src=ram_head; }

ajax - AutoSave Not Working -

can see obvious reason why autosave not working? set alerts , works until hits $.ajax call var timer; $('#about').keyup(function () { cleartimeout(timer); timer = settimeout(function (event) { var aboutval = $('#about').val(); var memberid = $('#memberid').val(); $.ajax({ url: 'includes/auto-save-about.asp', data: 'aboutval='+aboutval+'&memberid='+memberid, success: function(data) { $("#aboutstatus").html('saved').show().fadeout(3000); } }); }, 2000); });

How to call an existing defined javascript function with an prototypejs ajax onSuccess event? -

all documentation can find has defining actual function call within ajax constructor new ajax.request('/your/url', { onsuccess: function(response) { // handle response content... } }); but code throws error saying "uncaught typeerror: undefined not function" here code trying call existing function pullcomments(). function addcomment(){ // stringify json var commentstr = $('#commentbox').value; var jsonobj = { "dealid" : dealid, "username" : "default", "comment" : commentstr }; jsonobj = json.stringify(jsonobj); var jsoncomment = encodeuricomponent(jsonobj); new ajax.request("php/savecomment", { method: 'post', parameters: "comment=" + jsoncomment, onsuccess: pullcomments() }); } function pullcomments(){ // grab comments deal var xmlhttp **** chan...

internationalization - How to change the locale when useing i18n in Android? -

i want develop app supporting language. don't know how set locale. user can change language want. know android try set xx/strings.xml automatically according device setting. how set manual? go settings. there should language , keyboards setting. change whatever language want.

xml - Making Element Values Unique -

i have small xml project i'm doing defining schema chess game state made in xml. includes creating chess piece elements , creating child elements these pieces reference position in pgn (positional game notation). the document continues defining king, queen etc , position(s). how ensure value within position tag unique i.e., pawn cannot have 2 positions @ 17 having 2 pieces on same square of board. <position>17</position> <position>17</position> i tried using unique constraint freaked out @ fact have multiple position elements within piece element. how make value of these pieces unique , no 2 pieces can share same position value? edit: placement of unique constraint works position elements within same piece tag, there way position throughout whole document. example: <board-side name="white"> <pieces> <piece name="pawn" symbol="p"> <position>12</position> <boa...

java - How to add 1 drawing with a button to JFrame ? -

my drawing class: example want draw simple line public class drawnot1 extends jpanel { private basicstroke bs = new basicstroke(2); private int x; private int y; public drawnot1(int x, int y){ setsize(100, 100); this.x = x; this.y = y; } @override protected void paintcomponent(graphics g){ super.paintcomponent(g); dodrawing(g); } private void dodrawing(graphics g){ graphics2d g2d = (graphics2d) g; g2d.setstroke(bs); g2d.drawline(x, y, x, y+10); } my jframe class: public class main extends jframe{ private int x; private int y; public main() { initui(); } public void initui() { setsize(600, 500); settitle("points"); setlocationrelativeto(null); setdefaultcloseoperation(jframe.exit_on_close); add(new drawnot1(20, 20)); add(new jbutton("button1")); } public static void main(string[] args) { swingutilities.invokelater(new runnable() { @override public void ...

endianness - java numeric type conviersion when the underlying platform is big endian -

i'm wondering happens when write following java code on big-endian platform: int = 1; byte b = (byte)a; on little-endian platform, layout of variable a's 4 bytes x01000000, converting a byte, still x01, makes b equals 1. however, on big-endian platform, laid out x00000001, b still equal x01? if does, how magic happen? operations performed in registers in cpu, not in memory. registers neither big-endian nor little-endian , not randomly accessible. in case, behaviour defined in java language specification keeping lower bits in each case, wouldn't matter how cpu works. how magic happen? no magic, cpu discards higher bits. (technically cpu may sign extension many cpus have 32-bit or 64-bit registers) how bytes stored in memory before did doesn't matter.

c# - Securing WebAPI with [Authorize] attribute vs. User.Identiy.IsAuthenticated -

i have webapi controller requires users authenticated , i'm using ms identity 2.0 authentication. controller looks this: [route("myroute")] [authorize] [httppost] public httpresponsemessage post([frombody] string value) { if (user.identity.isauthenticated == true) { .... } else { return new httpresponsemessage(system.net.httpstatuscode.forbidden); } if remove 1 of these options @ time, in both cases, when unauthorized user calls controller, returns forbidden response. what's difference between these 2 options , there 1 that's better other? thanks. with [authorize] attribute, authorization logic can overridden filters , located @ central location in code. the if (user.identity.isauthenticated == true) { .... } else { return new httpresponsemessage(system.net.httpstatuscode.forbidden); } basically same default [authorize] functionality, you'll repeating on , over. a technical detail though, authoriza...

c# - XPath select node in Xaml -

i match node within xaml-file , file looks this: some xaml (xml-like) input: <somenode> <!-- root btw --> <!-- [...] --> <somenode.anyproperty> <!-- [...] --> </somenode.anyproperty> <!-- [...] --> </somenode> and want math section ' somenode.anyproperty '. afterwards want replace found node generated one. any suggestions working xpath expression? tried common expression apply on usual xml-file like: "somenode.anyproperty". sure, did not worked. working solution: thanks support. problem not xpath expression itselft. furthermore namespace declaration of xaml input file. avoid namespace problems used modified version of @malkam solution. xdocument doc = xdocument.load("somefile.xaml"); //get required element xelement nodetoreplace = doc.elements().where(x => x.name.localname == "somenode.anyproperty").firstordefault() xelement; //replace requried el...

java - Sort Map By Value Object Member -

this question has answer here: sort map<key, value> values (java) 44 answers i have generic map defined thus map<integer, book> bookcollection the integer book id , book book object. book object has member called publicationyear. how sort map book objects in order book's publicationyear member. so, if iterate through sorted map, oldest book appears first newest book. at moment, map randomly sorted. the publicationyear has part of key. sort based on that.

awk - How to copy numeric data from file to array in Linux -

i have data in output.txt shown below. wanted copy data file array in linux. wanted using awk. 3.2222196800737746e-01 9.0625504539639357e-02 -4.4309220157707685e-01 7.6522564411406657e-01 -7.1683767983542657e-01 4.8589460714063371e-01 -2.5294463208548001e-01 2.8153758928251349e-01 -1.9848560597677056e-01 you this: arr=($(cat output.txt)) echo ${arr[0]} 3.2222196800737746e-01 echo ${arr[2]} -4.4309220157707685e-01 first data stored in slot 0 second in slot 1 etc.

android - ADT does not recognize a device while operating system does -

excuse me if off-topic or has been answered in thread, not find solution. i have bq edison 2 qc tablet (spanish brand: [ http://www.bqreaders.com/productos/edison-2-quad-core.html] ). when connect usb cable, can see in desktop , can transfer files operating system, eclipse/adt not see it. developing android app , can not install on device. i runnig linux mint debian edition, , date. when connect device (nexus 7 or samsung galaxy ii), eclipse/adt see , can launch application on either. i have activated developer options , usb developing in tablet. i tried install android-tools-adb , edited /etc/udev/rules.d/51-android.rules, including line sysfs{idvendor}=="2207", having obtained 2207 lsusb tablet (and rebooted, etc). anyway, adb package not needed recognize other android devices adt, have uninstalled again. eclipse environment starts own copy of adb contained [adt-bundle-linux-x86_64-20140321]/sdk/platform-tools. don't know store vendor id's, because /etc/...

javascript - jquery more click function using data attribute -

i have link multiple contents (result of db query). tried using more 1 click function, site slow, tried doing this. the html element written php: <img id="click" src="images/like.png" alt="" width="80%" data-event="'.$rows[$i][id].'"/> the jquery code: <script> $(document).ready(function() { $('#click').click(function() { var id = $(this).data('event'); if (window.xmlhttprequest) {// code ie7+, firefox, chrome, opera, safari xmlhttp=new xmlhttprequest(); xmlhttp.open("get","likes.php?eid="+id+"&ip=ipaddress",true); xmlhttp.send(); } document.location = "index.php"; }); }); </script> but works on first element... $("#click") will return first element...

Stata: Combine table command with ttest and output latex -

for regression output, use combination of eststo store estimations, estadd add r2 , additional tests, estab output lot. i need same table command. need mean, median , n variable across 3 by variables , add stars result of ttest==1 on mean , signtest==1 on median. have 3 by variables , i've been using table collate mean, median , n, i'm calling following pseudo-code: sysuse auto,clear table foreign rep78 , /// contents(mean price median price n price) format(%9.2f) ttest price==1, by(foreign rep78) signtest price=1, by(foreign rep78) i've tried esttab , estpost no avail. i've looked @ tabstat , tablemat , summarize alternatives table , don't allow 3 by variables . how can create table, add stars ttest , signtest p-values , output full table? the main point in question seems producing latex table. however, show "pseudo-code", looks pretty stata code, caveat illegal. in particular, ttest can have 1 variable in by() opt...

c# - How to create Image in Timer method? -

for example. have timer , i'm initializing in window constructor. public mainwindow() { initializecomponent(); checktimer = new timer(3000); checktimer.elapsed += checktimer_elapsed; checktimer.start(); } and checktimer_elapsed method: void checktimer_elapsed(object sender, elapsedeventargs e) { messagebox.show("firsttext"); image img = new image(); messagebox.show("secondtext"); } why loading first messagebox window? but, if function called not timer ok. public mainwindow() { initializecomponent(); somefunc(); } void somefunc() { messagebox.show("firsttext"); image img = new image(); messagebox.show("secondtext"); } i believe threading problem. if recall event getting called timer on new thread. trying ui work not on ui thread (which not allowed). couple of solutions this, simplest of use dispatchertimer instead of timer. can find in system.windows.threading; the ev...

crash - PySide crashing Python when emitting None between threads -

Image
[edit] not pure duplicate of pyside emit signal causes python crash question. question relates (now) known bug in pyside preventing none being passed across threads . other question relates hooking signals spinner box. i've updated title of question better reflect problem facing. [/edit] i've banged head against situation pyside behaves subtly different pyqt. well, subtly pyside crashes python whereas pyqt works expect. i'm new pyside , still new pyqt maybe i'm making basic mistake, damned if can figure out... hoping 1 of fine folks can give pointers! the full app batch processing tool , cumbersome describe here, i've stripped problem down bare essentials in code-sample below: import threading try: # raise importerror() # uncomment line show pyqt works correctly pyside import qtcore, qtgui except importerror: pyqt4 import qtcore, qtgui qtcore.signal = qtcore.pyqtsignal qtcore.slot = qtcore.pyqtslot class _threadsafecallbackhe...

java - How might an algorithm search for a phrase within a large file? -

let's have large text file (few mb gb) of random text, consisting of lowercase letters, no spaces. however, appends string somewhere in middle of (consisting of lowercase letters, no spaces) of words english language. how go finding string , says, given not know string supposed (only it's in english, , not random text)? can use dictionary of english words. build dictionary trie , traverse file. o(n) time in size of file (i believe o(file size * trie depth) in worst case) , o(1) memory (fixing size of dictionary , assuming small largest word). streamable , ram-efficient, scale to, say, terabyte of data gigabyte of ram.

How to run url from cronjobs with javascript code in my php file -

i have url , want execute url cronjobs. in php file there javascript code export highchart. this code: <script> $(function () { var options = { title: { text: 'daily chart', x: -20 //center }, exporting: { url: 'http://export.highcharts.com/' }, xaxis: { categories: [ 'a','b', ] }, yaxis: { title: { text: 'idr' }, }, tooltip: { valuesuffix: '°c' }, series: [{ showinlegend: false, name: 'daily', data: [ 1,2 ] }] ...

How to disable auto-generated unit tests in Grails 2.3.x -

is there global setting disable auto-generation of unit tests in grails 2.3.x? i created controller using create-controller com.foo.mycontroller , , grails auto-created com.foo.mycontrollerspec ...while nice, want prevent occurring. according this , create-* or generate-* action auto-generates unit tests, documentation fails mention how, if @ all, can disabled. you can create class manually inside ide or editor. controller class pretty simple (just class ending convention “controller” in grails-app/controllers directory)

android - Cordova Splash Screen? -

im doing app using cordova, , im trying use splash screen android, don't know how or if have install plug-in, splash screen ios working fine. hoping 1 can point me on right direction on how apply splash screen android check link : android splashscreen configuration in cordova splashscreen (string, defaults splash): name of file minus extension in res/drawable directory. various assets must share common name in various subdirectories. just add below line inside config.xml file : <preference name="splashscreen" value="mysplash"/> note : mysplash png file res/drawable folders.

Spring-security-3 browser back button issue -

i trying learn spring security 3. while running example of spring security button takes me previous page . want stop this. try using spring security.but not resolved,please help.here code security file <?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:security="http://www.springframework.org/schema/security" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemalocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.2.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> <mvc:annotation-driven /> <mvc:interceptors...

meteor blaze rendered being called before DOM completion -

i have template shows qrcode user id : <template name="pairdevice"> {{#with currentuser}} <div id="qrcode"></div> <div class="key" id="qrcodevalue" style="display: none;">{{id}}</div> {{/with}} </template> i tried setting value rendered , helper, it's same problem $('#qrcode') , $('#qrcodevalue') return [] fields don't exist yet. template.pairdevice.rendered = function(){ if (!location.origin) { location.origin = location.protocol+"//"+location.host; } // $('#qrcode').qrcode({width : 128, height :128 ,text : $('#qrcodevalue').html()}); }; template.pairdevice.helpers({ 'id' : function(){ var appuser =meteor.user(); var value = location.origin + ";" + appuser._id + ";" + appuser.emails[0].address; $('#qrcode').qrcode({widt...

c# - Create a custom control in Corel Draw X6 using only VSTA -

i in process of creating plugin (or addin) coreldraw x6 using vsta (visual studio applications) because c# , .net library . have button in coreldraw toolbar, when user clicks button action happens, example, form showed. use predefined solution vstaglobal , there me when start coreldraw . unfortunately, there no official documentation (wtf!!!!!) vsta in coreldraw , instead have vba (visual basic applications) documentation , coreldraw object model . googled lot , found few links: some forum post , youtube video tutorial . problem is, both guys there create customcontrol (a buton example) , build *.dll , use vba script add customcontrol coreldraw toolbar this sub addlinewidthcontrol() call framework.commandbars("standard").controls. ' addcustomcontrol("mynamespace.mycustomcontrolclass", ' "mycustomcontrolassembly.dll") end sub so, question is: is there way using vsta ? additional info : ...