Posts

Showing posts from January, 2015

ruby - How to do ransack sorting through AJAX? -

i working rails 3.2 ruby 1.9.3 , using ransack 0.6.0. i have model called activities in application , displaying model data in partial through ajax ransack (sorting , searching). when click on of sort_link of field, result displayed in new page not in partial. need display result in same partial without refreshing page. here model activity.rb: class activity < activerecord::base belongs_to :user belongs_to :category belongs_to :folder belongs_to :organization has_many :attachments attr_accessible :date, :info, :tags, :attachment, :category_id, :priority, :assigned_to, :notify, :activity_type, :task_desc, :task_status, :due_date, :task_state, :folder_id, :attachments_count, :attachments_attributes, :user_id, :organization_id end here controller activities_controller.rb: def tasks @type = params[:type] @state = params[:state] @status = params[:status].split(',') if !params[:status].nil? @due_date = change_date_format1(params[:date...

Error in MapReduce command with MongoDB Java API -

i'm testing mongodb java api , wanted mapreduce. implemented follow : string map = "function() { " + "emit(this.ts, this.1_bid);}"; string reduce = "function(key, values) {" + "return array.sum(values);}"; mapreducecommand cmd = new mapreducecommand(collection, map, reduce, null, mapreducecommand.outputtype.inline, null); mapreduceoutput out = collection.mapreduce(cmd); (dbobject o : out.results()) { system.out.println(o.tostring()); } but when execute have following exception stack : [tick_engine] 16:51:53.600 error [mongotickdatareader] failed read data mongodb com.mongodb.commandfailureexception: { "serverused" : "/127.0.0.1:27017" , "errmsg" : "exception: syntaxerror: unexpected token illegal" , "code" : 16722 , "ok" : 0.0} @ com.mongodb.commandresult.getexception(commandresult.java:71) ~[mongo-2.11.1.jar:na] @ com.mongodb.commandresult.throwonerr...

sql - Syntax error with pgSQL, using functions and if else -

i'm practicing little bit postgresql, i'm creating simple function inserts row table depending on value of variable 'num'. however, when try create function following error in pgadmin iii: "an error has occured: error: syntax error @ or near if line 3: if num = 1 then" this code: create function "elseif"(in num integer) returns void $body$ if num = 1 insert "accounts"( "email", "password") values ('email1', 'password1'); else insert "accounts"( "email", "password") values ('email2', 'password2'); end if; $body$ language plpgsql volatile not leakproof; alter function public."elseif"(in integer) owner repository; any possible solution? in advance! you forgot begin . pl/pgsql must wrapped in begin ... end block. ... returns void $bo...

amazon s3 - Go Connecting to S3 -

working on learning go, , writing component manage pictures. i've been looking @ s3 library here: https://godoc.org/launchpad.net/goamz/s3#acl in node, use knox client , connect bucket this: var bucket = knox.createclient({ key: config.get('aws_key'), secret: config.get('aws_secret'), bucket: "bucketname" }); in go s3 library see of functions need work s3 bucket, can't find connect function - similar 1 above. so far, i've found in docs: type auth struct { accesskey, secretkey string } and seems need call function: func envauth() (auth auth, err error) this envauth function: func envauth() (auth auth, err error) { auth.accesskey = os.getenv("aws_access_key_id") auth.secretkey = os.getenv("aws_secret_access_key") // fallback ec2_ env variables if aws_ variants not used. if auth.accesskey == "" && auth.s...

C# XNA Creating object on-click -

i creating program simulates ants running around, collecting food , depositing in nest. want user able click , add nest object @ cursor point. want object created added list of nests. so far, have tried in update method in main game class. mousestatecurrent = mouse.getstate(); if (mousestatecurrent.leftbutton == buttonstate.pressed) { int foodwidth = 50; int foodheight = 50; int x = mousestatecurrent.x; int y = mousestatecurrent.y; foodposition = new rectangle(x, y, foodwidth, foodheight); food = new stationaryfood(foodposition); foodlist.add(food); } this compiles when click game crashes , error saying when food object drawn in 'draw' method, texture food null. understand why happening, have tried load in textures follows in loadcontent() method in main game class foreach (stationaryfood f in foodlist) { f.charac...

sql server - Processing Mp3 links c# -

i have more thank 100,000 of mp3 links in sql table. need album/artist information every song link. there way, can without downloading song. reson, asking is, if download every song, take huge space on hard drive, dont want. also, take lot of time download songs. i can download song using webclient client = new webclient (); client.downloadfile("http://myserver.com/indie/band1.mp3", "band1.mp3"); and taglib to song information. what best options have ? regards paraminder download file -> extract information -> delete file. ===> way workaround space concern. there isn't anyway extract info(beside extension , name) of file without reading header.

javascript - How to detect default drag event of browsers using jquery -

suppose there text in browser. if select text, browsers allow dragging can see dragged text. need know when user dragged text. can partial text also. if want detect if user drags text somewhere 1 of elements in page , not allow it, can try storing element's value in global var on keyup function , passing value again on mouseenter action. var buff = ""; $("input[name=buff]").on("keyup", function(){ buff = $(this).val(); }); $("input[name=buff]").on("mouseenter", function(){ $(this).val(buff); }); check fiddle , try dragging text textbox. it's not working ie9 can events detect that.

Write a Java program to summarize the data from an input file and output a report -

i need writing java program summarize data input file sprocketorders.txt , output report similar 1 below: spacely sprockets taking sprockets future sales summary report sprocket number total quantity sold 1 90 2 155 3 50 4 300 5 100 the data in chart comes .txt file named above. info contained in txt file such: 3 50 2 20 2 100 5 15 1 90 5 85 4 300 2 35 3 100 the report needs appear in output window. i want use switch structure. switch structure fragment have use reference: switch (snum) { case 1: part1total = part1to...

database - Foreach and getting tags and categories from other tables -

i had hard time think title, hope explains. posts table +----+---------+-----------------+ | id | title | text | +----+---------+-----------------+ | 1 | title 1 | example | | 2 | title 2 | example | | 3 | title 3 | example | +----+---------+-----------------+ tags table +----+--------+ | id | tag | +----+--------+ | 1 | jquery | | 2 | php | | 3 | stack | +----+--------+ category table +----+------------+ | id | category | +----+------------+ | 1 | category 1 | | 2 | category 2 | | 3 | category 3 | +----+------------+ post tags relation table (same thing category) +---------+--------+ | post_id | tag_id | +---------+--------+ | 1 | 1 | | 1 | 2 | | 2 | 3 | +---------+--------+ this result want see in view: +---------+------------------+--------------------+------------+ | title | text | tags | categories | +---------+------------------+--------------------+------------+ | ...

ios - How to use UIButton as Toggle Button? -

i trying create toggle button each cell in table. when pressed, change image , when pressed again change image again -- toggle. in uibutton class don't see selected state. i'm looking way create toggle button uibutton can change state on each click. this how i'm doing in rubymotion right using rmq @fav_button.on(:touch) |sender| puts "pressed fav button id: " + data[:id] + " , name: " + data[:name] #how change state here? end you can create toggle button easily, need set respective images respective states, after that, can use selected property toggle between these images. i made pure objective-c code show how can that, can set images anyway in storyboards ou xibs too, check out: // first, set images normal state , selected state [button setimage:normalimage forstate:uicontrolstatenormal]; [button setimage:selectedimage forstate:uicontrolstateselected]; // don't forget add action handler toggle selected property [...

Runtime configuration of Eclipse workbench layout -

i know file .metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi save eclipse workbench layout after closed. , use file export layout settings. however, using file, need close workspace want replace workbench.xmi file first, replace file, reopen workspace. wondering eclipse save workbench layout information when running? can replace file when workspace still opened? when running workbench layout held in internal emf model should not access directly. code using e4 api can query , modify model using emodelservice interface. to understand how works need read on eclipse e4 using tutorial such this one note: applies eclipse 4.x, eclipse 3.x different.

Windows Azure Storage Emulator failed to install -

i wasted whole day trying install windows azure storage emulator somehow not getting installed.. the log showing me error : sql instance not found. tried re-installing sql server 2012 did not help. not able find sql instance @ all.. here detailed log : http://pastebin.com/kuw4mjuf i tried googling around ended no solution @ all. :-( can't go ahead without azure storage emulator.. i hope here help. there may issue sqllocaldb user database v11.0 during install. need recreate (see below). as far i'm concerned, first install attemp left files in c:\users[user] directory : wastorageemulatordb30.mdf wastorageemulatordb30_log.ldf (your version numbers may differ.) sqllocaldb logs mention these files still existed , not erase them. i deleted them manually. recreated v11.0: sqllocaldb stop v11.0 sqllocaldb delete v11.0 sqllocaldb create v11.0 and reinstalled... hope helps ! oa

java - Selector.select() does not block -

sorry, searched around 2 days before had post question. there similar questions, none of them helped me. i trying create simple chat application client uses (non-nio) socket connect server listens nio serversocketchannel. server uses selector. until first client connects, selector.select() method blocked, expected. after first client connects, selector.select() not block , returns immediately. causes while loop run continuously. sorry, i've pasted entire code can copy-paste , run it. i've started java, help/pointers appreciated. thank you. p.s.: right now, client sends serialized object (message object) on socket connection , server reads it. since connection non-blocking, serialized object pre-fixed object size (in bytes) before sent server. allows server read next "x" bytes , un-serialize message object. server code work in progress. client code---------- import java.io.bufferedinputstream; import java.io.bufferedoutputstream; import java.io.bytearrayi...

Change background color javascript in specific order -

i'm new javascript, , need bit of help. want web page's background color changes #003372 #ffffff , #be2e37 in specific order (every 1000 milliseconds), without generating them @ random. reason why because made flash movie on website , want match colors appear. javascript: <script type="text/javascript"> function changebackground() { var colors = ["#003372","#ffffff","#be2e37"]; setinterval(function() { var bodybgarrayno = math.floor(math.random() * colors.length); var selectedcolor = colors[bodybgarrayno]; document.body.style.background = selectedcolor; }, 2000); } </script> html: <body onload = changebackground();> try this: function changebackground() { var colors = ["#003372","#ffffff","#be2e37"], icolor = 0; setinterval(function() { if (icolor > (colors.lengt...

sql - select unique values in one column and match with the criteria in another column -

need group table below (1) ouput table (2) these sample values, in real they're corresponding numbers , code. id should unique , code should match criteria ( if xz exists xz; if xz , xy exists select xy , on) tried 'if exists' , 'case when..then' not luck far, since both column have pk . use sql server 2008, thanks id code 101 xz 102 xz 102 xy 103 xz 103 xa output 101 xz 102 xy 103 xa study ranking functions , of great in grouping queries. with cte ( select id,code, row_number() over(partition id order code) row tablename ) select id,code cte row=1

php - How to make archlinux lamp dev friendly? -

i switched ubuntu manjaro on little php dev netbook. i follow archlinux wiki install lamp stack. put websites projects in public_html . it works if manually create files. not when extract files (old projects zipped). so on ubuntu, changed apache_run_user , apache_run_group, can't find them on manjaro (archlinux). what should develop did on archlinux based distro ?

shell - How to check if the directory is symlink in chef -

i want delete directory if not symlnik. directory "/var/www/html/" action :delete only_if ??? end the selected answer not work on windows or systems bash default interpreter. should use ruby solution cross-platform (and faster, since there's no process spawning): directory '/var/www/html' action :delete not_if { file.symlink?('/var/www/html') } end

Get nth parent in DJANGO -

i have models this: a->b->c->d b parent of a , c parent of b ... i have a object database. best way related d object a object? to retrieve instance of d instance of a : d_instance = a_instance.b.c.d where a_instance instance of class a . whether "best way" question; depends on mean "best". performance-wise depends on how data structured. remember join effected each time entity (or parent) accessed using dot notation shown above.

can't add foreign key in mysql (through phpmyadmin) -

Image
error: cannot add foreign key. check data type. what wrong data type? fixed it! cannot set null columns can't null

cocoa touch - Objective-C - Changing Inactive UITabBar Image Colour -

Image
i'm trying find way change tint colour inactive images on uitabbar - here image of current progress i'm trying change colour of gray image to, currently, other colour, without luck. here code using: [[uitabbar appearance] setselectedimagetintcolor:[uicolor whitecolor]]; [[uitabbar appearance] settintcolor:[uicolor whitecolor]]; i've been searching on google way make work having no luck. appreciated. if trying achieve displaying of actual image @ uitabbar use following code: tabbaritem.image = [tabimage imagewithrenderingmode:uiimagerenderingmodealwaysoriginal]; and if want display image in original condition selected use following : tabbaritem.selectedimage = [tabimage imagewithrenderingmode:uiimagerenderingmodealwaysoriginal]; these 2 alternative deprecated methods setfinishedselectedimage: , withfinishedunselectedimage:

Declare and use List in java -

i touch java, found if need create new list list<string> = new arraylist<string>(); but in homework, code following. in function postering, parameter list<integer> positions . can put 'arraylist' there? or usually put list there? could explain in detailed way? static class posting { int docid; list<integer> positions; public posting(int docid, list<integer> positions) { this.docid = docid; this.positions = positions; } } list<integer> interface ; arraylist<integer> class implementing interface. should use list<integer> , because lets caller change implementation - example, linkedlist<integer> . this technique improving flexibility known programming interface. can read more advantages in answers question .

php - I want to sum the looped name in textboxt in html using javascript -

i guys new php , javascript , have problem want loop name inside textbox < form name ="rec" action="this.php" method="post" > < ?php x=0; while(x <=5){ x++; echo" < input type='text' name='n".$x."'>"; ?> < /form> < script > x=0; while(x <=5){ x++; = number(document.rec.n"+x+".value) document.rec.n"+x+".value = a; } < /script> i hope understand php working dunno how loop inside name of javascript. need help instead of this: document.rec.n"+x+".value try this: document.rec["n"+x].value

php - How to assign validations for model and controller in cakephp? -

i developing 1 register form.but dont know how validations in cakephp register form in controller class. model class: user.php <?php class user extends appmodel { var $name='user'; //var $usetable = false; var $validate= array( 'username'=>array( 'rule'=>'notempty', 'required'=>true, 'message'=>'enter name' ), 'email'=>array( 'email'=>array( 'rule'=>'email', 'message'=>'enter valid emial address' ), 'email'=>array( 'rule'=>'notempty', 'required'=>true, 'message'=>'enter email address' ) ), 'password'=>array( ...

google app engine - Can I have multiple versions deployed on openshift? -

for research project comparing paas providers. i'm not sure following. on app engine can have multiple live versions of application. if have new version , deploy can reach on non-default url like: versionx.myapp.appspot.com. can use url test while running on paas. once i'm happy result change default version , visitors see changes. i wondering if openshift has simular? thing found far deploys on git push , if fails build leave old version live. of course still leaves risk functional errors. if still have install test-server locally still doing system administration , nice if can prevented. how best resolved when using openshift? edit: did found article: https://www.openshift.com/blogs/release-management-in-the-cloud is way or there other common ways this? the best way re-create google functionality run dev/qa instance on separate gear , add git repositories remotes local git working copy, can git push environment testing before deploy production.

Error in HTML form when using <label> tag -

i making web form have working , trying style using css before building site it. have found after adding label tags getting errors when click on box jumps first name box, way fill out form use tab. my html: <label> <form action="register keys site/form.php" method="post"> first name: <input type="text" name="first_name"><br> last name: <input type="text" name="last_name"><br> email: <input type="text" name="email"><br> phone number: <input type="text" name="phonenumber"><br> information on key: <input type="text" name="keyinfo"><br> password: <input type="text" name="password"><br> password hint: <input type="text" name="passwordhint"><br> <textarea rows="5" name="message" cols="30" placeholder...

java - What's wrong with Android's Random.nextInt(2^N)? -

i executed following code several times clicking button: int = 4; log.println(log.debug, "random", new random().nextint(up) + " " + new random().nextint(up) + " " + new random().nextint(up) + " " + new random().nextint(up) + " " + new random().nextint(up) + " " + new random().nextint(up) + " " + new random().nextint(up) + " " + new random().nextint(up) + " " ); and surprised of getting in log: 04-07 21:26:36.659: d/random(15640): 1 1 1 1 1 1 1 1 04-07 21:26:37.059: d/random(15640): 2 2 2 2 2 2 2 2 04-07 21:26:37.429: d/random(15640): 2 2 2 2 2 2 2 2 04-07 21:26:37.789: d/random(15640): 2 2 2 2 2 2 2 2 04-07 21:26:38.119: d/random(15640): 1 1 1 1 1 1 1 1 04-07 21:26:38...

Show table data upon attaching MDF file to SQL Server Mgmt Studio -

i have mdf file , attached sql server mgmt studio , find database's tables , columns no data @ ! how can retrieve data each table , browsing through rows , columns ? browse top 1000 as suggested @paqogomez right click on table name "tblxyz" , select "select top 1000 rows. opens query editor , displays query code @ top , result set @ bottom of screen. select top 1000 col1, col2, col3 tblxyz simple select statement you modify above query code remove "top 1000" rows table. select col1, col2, col3 tblxyz repeat same right click "edit top 200" rows editing.

ruby on rails - Speed up OpenUri by keeping connection open? -

is there way speed openuri connections in ruby, maybe somehow keeping stream open? here i'm doing retrieve data: doc = nokogiri::html( open(url).read ) which seems slow when batch processing several thousand urls. if you're processing several thousand urls using openuri, you're using wrong library. instead should looking @ let process them in parallel. i recommend @ using typhoeus , hydra . typhoeus the code gets url, , hydra handles multiple connections. check out examples on main page see how easy have many parallel connections running @ once. run benchmark tests determine @ point saturate host, , internet connection. trying run more connections pipe can handle wastes cpu time. also, careful if you're trying process multiple connections same host you're eating bandwidth , cpu too, great way banned.

ajax - jQuery, click event doesn't fire -

my problem (because solved it, don't know why worked): had 2 'span' tags inside dom same css class. 1 span added via ajax request. trying fire click event on them using: $('.css class').on('click', function ... but 'span' tag added second (ajax) didn't produce click event. when i've changed above line to: jquery('body').on('click', '.css class', function(e){... everything started work should. don't know why. use event delegation: $('body').on('click','.css-class',function(){ // code goes here. }); remember not have spaces in class. otherwise you'll targeting <class> under .css on() event handlers bound selected elements; must exist on page @ time code makes call .on(). ensure elements present , can selected, perform event binding inside document ready handler elements in html markup on page. if new html being injected page, select ele...

python - Numpy, masking and sklearn clustering -

i having issue modifying 3d 2d in order supply bandwidth function mean shift calculation. query db data in 1d array of values , set of idÅ› belong these values - me later identify sources. prior calculation add 1 more dimension ensure calculation go right , of these results being kept in 3d array. need supply 2d containing value , 0 calculating function, having trouble constructing 2d compressed (without thrid value describing id) array that. know how using numpy , not having separate list containing id's? source array: [(2.819999933242798, 0.0, 16383) (3.75, 0.0, 16384) (3.75, 0.0, 16385)] array after has been masked: [(2.819999933242798, 0.0, --) (3.75, 0.0, --) (3.75, 0.0, --)] array needs be: [(2.819999933242798, 0.0) (3.75, 0.0) (3.75, 0.0)] cheers you first convert numpy array: h=[(2.819999933242798, 0.0, 16383), (3.75, 0.0, 16384) , (3.75, 0.0, 16385)] a=np.array(h) and columns want: a[:,0:2] gives: array([[ 2.81999993, 0. ...

jQuery AJAX parses HTML response as JSON -

i cant find on web mysterious bug. wrote simple ajax calling cakephp controller-function render simple view. want put rendered html popup: the ajax: $.ajax({ url: $('base').attr('href') + '/mycontroller/renderpopupcontent/' + this.view, type: "get", datatype: "html", context: this, success: function( data ) { this.content = data; this.show(); }, error: function(xhr, status) { showmessage(status, xhr); } }); now jquery-error says: uncaught syntaxerror: unexpected token < this because jquery tries (automatically^^) parse response json. if debug script breaks @ jquery (1.9.1) @ line 541 , tries parse html-response (string!) into/from json. how can avoid , jquery known of datatype "html" additional info: the jquery-error (@ln541) occures after "alert();" in success-callback, ajax done when error thrown. found issue: somewhere in js-file fou...

Google Cloud Storage can't retrieve buckets or contents of buckets -

as of morning unable access storage buckets. when select google cloud storage tab on navigation loads expected, rather displaying 2 buckets displays alert bar saying: we unable retrieve buckets. click retry as i'm aware of link in bucket, tried clicking on , again, page loads successfully, receive new error message stating: unable retrieve objects. click retry this true both of buckets. has experienced , resolved problem before? edit: can interface objects in buckets using both api , load them through browsers to quote @zach-wilt : "i believe should fixed of few hours ago. still seeing these errors? record, bug reports , feature requests can sent gs-team@google.com, mentioned in our docs: developers.google.com/storage/docs/resources-support"

android - Posting with DENY privacy not working (And how to save privacy) -

my android app posts status deny privacy friends (who cannot see), it's not working. here's graph api call: post me/feed?message=this message &privacy='value':'custom','deny':'friend_1_id,friend2_id'}` however, it's working allow privacy this: post me/feed?message=this message &privacy='value':'custom','allow':'friend_1_id,friend2_id'} how can deny achieve goal without using allow? (important) how can setting custom privacy user's facebook? because want facebook app keep privacy (user not need change setting again when using original facebook app). note: app works facebook sdk 3.8 how can `deny` achieve goal without using `allow` according facebook developers [ src ]: by design . when use custom privacy, should specify allow field, or default you'll only person able view post. so instead of: post me/feed?message=test&privacy={'value':'custo...

javascript - Date difference larger than intended -

i learning use date object in javascript. tried calculate difference between , set date, returns larger value inteded. codepen here , can't seem figure did wrong... help? var setdate = new date(2014, 4, 27, 14,30); //27th of april year @ 14:30 var = new date(); //now, whenever code runs var diff = math.round((setdate.gettime() - now.gettime())/1000); //difference in seconds function nicetimer(delta) { //decompose difference in seconds date units. this.days = math.floor(delta/ 86400); delta -= this.days*86400; //subtract value once has been "extracted". this.hours = math.floor(delta/ 3600); delta -= this.hours*3600; this.minutes = math.floor(delta/ 60); delta -= this.minutes*60; this.seconds = delta; this.printstring = function() { return "the event starts in "+this.days+" days, "+this.hours+" hours, "+this.minutes+" minutes , "+this.seconds+" seconds"; //output readable countdown string } ...

c# - Add refrence to Iconic.dll (DotNetZip) In My Wix Installer -

i have program uses file 'ionic.zip.dll' dotnetzip library , apply installer program. i'm using dotnetzip . now cant add reference 'ionic.zip.dll' wix(installer) project, when try add reference following error: “a reference [filepath] not added. please make sure file accessible, , valid wix reference.“ i think wix accept projects reference , not dll files. what can ? lot help! i think wix accept projects reference , not dll files. i waiting this, since wasn't sure meant "reference". when comes wix find adding references projects/dlls utter pain . maybe i'm bad them, i'm not sure, easiest way found add project (and of it's dependencies) make bunch of component elements, , assign each 1 single file folder in file being compiled to, see general example below (this based off of how lay out product.wxs files): <fragment> <componentgroup id="mainprogramfiles" directory="installfo...

linux - python fabric error 'module' object has no attribute 'HAVE_DECL_MPZ_POWM_SEC' -

i getting following error when run fabric (env)[root@server-124 env]# fab traceback (most recent call last): file "/usr/bin/fab", line 9, in <module> load_entry_point('fabric==1.8.3', 'console_scripts', 'fab')() file "/usr/lib/python2.6/site-packages/pkg_resources.py", line 299, in load_entry_point return get_distribution(dist).load_entry_point(group, name) file "/usr/lib/python2.6/site-packages/pkg_resources.py", line 2229, in load_entry_point return ep.load() file "/usr/lib/python2.6/site-packages/pkg_resources.py", line 1948, in load entry = __import__(self.module_name, globals(),globals(), ['__name__']) file "/usr/lib/python2.6/site-packages/fabric/main.py", line 19, in <module> fabric import api, state, colors file "/usr/lib/python2.6/site-packages/fabric/api.py", line 9, in <module> fabric.context_managers import (cd, hide, settin...

asp.net web api - How to extract a context from an URL before reaching the route engine in Web API 2 + Attribute Routing? -

i'm migrating web service pure c# / no framework web api 2. web service exposes movies objects (with properties title, actors, plot...) , these movies objects contains videocontents objects. these videocontents objects associated device and/or specific siteinstance (think of catalog example). i have follow specific url model : /api/movies/1234 = returns movie #1234 of contents /api/{device}/movies/1234 = returns movie #1234 contents matching device /api/{device}/{siteinstance}/movies/1234 = returns movie #1234 contents matching device , siteinstance. i made first version "traditionnal" routing, had 3 routes defined : "api/{controller}/{id}" "api/{device}/{controller}/{id}" "api/{device}/{instance}/{controller}/{id}" and used iautofacactionfilter hook request, extract context , inject in controller. worked ! now, want migrate attributerouting because, well, seems "way go" , idea of routetemplate being near method f...

MapBox SDK for iOS fire tapOnCalloutAccessoryControl manually -

i wondering if there possibility fire taponcalloutaccessorycontrol method marker in code? instance, have list of markers, , when user clicks marker in list, zoom location, love callout popup. possible? thank you. getting callout pop different accessory control. latter (typically chevron-image) control in callout once popped up, "go more detail" button, basically. to callout popup, check out -[rmmapview selectannotation:] , friends.

How to execute a .vbs file in a linux OS from java -

i have .vbs file makes conversion of docx file pdf type file, run .vbs java in windows. since need program running in linux based os don't know if solution work. the .vbs , java code use project here in link: http://mydailyjava.blogspot.mx/2013/05/converting-microsoft-doc-or-docx-files.html note: tried other solutions convert docx file pdf, these solutions (docx4j, xdocreports, jodconverter) causes loss of format in final pdf file, apis not option. it unlikely able run mentionned programs on linux, since need: microsoft word installed, open word file , print it microsoft scripting host, execute vbs script a batch script interpreter can access scripting host since these items microsoft software, don't run natively on linux. so have find alternatives suggested vzamanillo, or maybe find way run in wine environment, that's not linux.

Android:High Quality Facebook Profile picture -

i need show facebook friends profile picture in app. i used url http://graph.facebook.com/uid/picture?type=large&redirect=true&width=600&height=600 i'm getting image in web browser not loading in android app.the issue not imageview,since checked image url gets appeared in imageview. imageloader.displayimage(http://graph.facebook.com/uid/picture?type=large&redirect=true&width=600&height=600, thumb_image); please help. the link provide give high clarity image.the problen happen link call using http use https this imageloader.displayimage(https://graph.facebook.com/uid/picture?type=large&redirect=true&width=600&height=600, thumb_image); thank you

powershell - MSMQ WMI Query Failing Due to Missing Performance Counters -

when trying execute following query powershell: get-wmiobject -query "select * win32_perfrawdata_msmq_msmqqueue" i receive error: get-wmiobject : invalid query @ line:1 char:14 + get-wmiobject <<<< -query "select * win32_perfrawdata_msmq_msmqqueue" + categoryinfo : invalidoperation: (:) [get-wmiobject], managementexception + fullyqualifiederrorid : getwmimanagementexception,microsoft.powershell.commands.getwmiobjectcommand i have diagnosed performance counters msmq missing, when in registry under system\currentcontrolset\services\msmq\ not see performance key. i found following microsoft kb on reloading performance counters steps in not work http://support.microsoft.com/default.aspx?scid=kb;en-us;936493 . when run "unlodctr msmq" error: unable open driver system\currentcontrolset\services\msmq\performance. status: 2 then when run "lodctr mqperf.ini" get: unable find initialization file mqperf.ini do...

swing - Jbutton too big java -

i'm having hard time jbuttons , , have 2 problems. the first have set proportions in frame gridbaglayout set size of jpanel . nothing strange far. program shows space in panel want add should stay. have 20 disposed in space, fitting dimension , respecting proportions. when created jpanel buttons gridbaglayout , weightx , weighty set 1 , result new grid went out space wanted fit in , program showed before. why don't buttons resize fit space while other jcomponents (like jlabel s, jtextfield s , horizontal/vertical struts) do? the second question regards button text dimension . buttons have default font, when try enlarge text size, buttons show " ... ", despite there space larger text dimension. how can fix this? thank in advance. ps: think first problem depends on second. edit: thought, first problem derived second. found method solve second problem , works. yay!

SQL PIVOT a table with no column names -

i had query returning value in list. eg: select * some_table name in ('name1', 'name2', 'name3', 'name4', 'name5', 'name6', 'name7', 'name8', 'name9', 'name10') i want see might not in list. eg: select * #list name not in (select name some_table) my list has few hundred values. how can turn list table? select 'name1', 'name2', 'name3', 'name4', 'name5', 'name6', 'name7', 'name8', 'name9', 'name10' into #list unpivot(?????) create table sometable ( -- reference table name varchar(20)); insert sometable(name) values ('name1') ,('name2') ,('name3') ,('name4') ,('name5'); select t1.name (values -- list compare reference table ('name1') ,('name2') ,('name129')) t1(name) except select n...

Git - remove remote branch with a space in the branch name -

i'm not sure how happened, have branch on our remote repository has space in it's name: remotes/origin/dev 3 i'm trying remove branch using following command, wont work, think because of spaces: git push origin :dev 3 i've tried different variants, such as: git push origin :dev\ 3 git push origin :dev3 git push origin :'dev 3' git push origin ':dev 3' none of these work, following error: error: unable delete 'release': remote ref not exist error: src refspec 3 not match any. any ideas on how remove remote branch please? i figured out how it! so using netbeans , gitk view branches , through tools, branch name "dev 3". tried listing using 'git branch -a' , turns out, branch name "dev_3"! so did git push origin :dev_3 , got rid of it. no idea why other tools not showing underscore. thanks!

ruby on rails - Mapbox fitBounds fits map to markers, but doesn't render tiles -

i building ruby on rails app creates unique map each product model in database , inserts slide of flexslider slideshow. this working json requests contain 1 marker. however, when json requests made 2 markers, map's tiles not render (but both markers displayed , fit view). the rendering issue solved moving "map.fitbounds(featurelayer.getbounds());" featurelayer.on('click') function. need functionality fitbounds after json loaded rather on click. the error in browswer console is: "uncaught typeerror: cannot read property 'lat' of undefined" have searched dozens of threads this, cannot solve it. newbie of this, appreciated. my javascript function initproductmap(product) { var map; map = l.mapbox.map(document.getelementbyid(product), 'jasonpearson.ha88l84b'); var featurelayer; featurelayer = l.mapbox.featurelayer().loadurl('/products/' + product + '.json').addto(map); map.scrollwheelzoom.disable(); ...

javascript - Clicking submit button does nothing using jquery delegate -

i trying use form in website loaded through javascript (from results of ajax call), submit button calls delegate function sends ajax call. this works in chrome , ie, in firefox clicking button nothing, there no javascript errors or either. 14/04/2014 edit: has started happening in chrome well, after no changes code the form built: tr += "<form method='post' data-opid='"+resultarr[i].columns.number+"' class='update_form' action='' name='form"+resultarr[i].columns.number+"'>"; tr += "<td><input type='submit' class='update' value='update'></td></form>"; and delegate function starts: jquery(document).delegate(".update_form", "submit", function(e){ alert("in delegate"); but alert never triggers in firefox. i have <a class='displayopp' href='../partner_detail/view/" + resultarr[i...

javascript - dynamic change of style on form condition via jquery -

trying set change of style via jquery on condition form entry right can't make work. here fiddle <div id="protectimages"> image library password <input class="libaccess" type="password" name="pwd"></input> <a class="libenter" href="#">enter</a> </div> and jquery $(document).ready(function(){ $("libenter").click(function(){ if ( $(".libaccess").val() != test ) { $(".protectimages").css('background-color','f6f6f6'); } }); }); where mistake? edited comments bellow. here fiddle http://jsfiddle.net/soloveich/lvxb2/2/ put code in <head> :- <head> <script src="http://code.jquery.com/jquery-1.11.0.min.js"></script> <script> $(document).ready(function(){ $(".libenter").click(function(){ if ( $(".libaccess").val() != "test" ) { ...

while loop - Error in the output of my java program -

i trying java program having problem output. here error when input information. enter social security number:12345678 enter salary3000 please input next security numbers or -1 quit:12345666 enter salary2122 please input next security numbers or -1 quit:900000000 enter salary3000 please input next security numbers or -1 quit:-1 exception in thread "main" java.util.unknownformatconversionexception: conversion = ':' @ java.util.formatter.checktext(formatter.java:2547) @ java.util.formatter.parse(formatter.java:2533) @ java.util.formatter.format(formatter.java:2469) @ java.io.printstream.format(printstream.java:970) @ java.io.printstream.printf(printstream.java:871) @ salaries.output(salaries.java:57) @ salaries.main(salaries.java:19) and here code far.. import java.util.scanner; public class salaries { public static void main(string[] args) { // todo auto-generated method stub scanner input = new scanner (...

aem - How to drag and drop a component over other components (other than parsys) in CQ5? -

i have created button component in cq5 without inheriting existing button component. want place button component on custom banner component drag , drop method sidekick. gave banner comp parent button , in banner gave button in allowed children , made container too. have created design dialog banner component added button component in allowed components option. still not able drag , drop button on banner, going either above or below banner , banner inside parsys. if include component via jsp, working fine. must drag , drop. i new cq5, appreciate can get. in advance. a parsys fundamental container component composition. applying functionality manually component require quite bit of custom configuration. if @ parsys @ /libs/foundation/components/parsys, see defined container property cq:iscontainer - true, instructs cq allow drag , drop. there multiple sub nodes need defined etc. if trying limit particular component dropped in, may make sense, , yo should @ image comp...

How automatically import JAR files in Lotus Java Agent? -

i'm developing java code in eclipse ide. wrote ant script export in jar files. i'd import these jar files in lotus agent through ant script too. don't know how :( i found topic, don't understand how can me how build lotus domino database using svn , ant, maven or gradle rombs, the headless designer command-line mention in post take whole notes database has been stored in source control system (and means has been translated hundreds of small files instead of being 1 monolithic file) , 'compile' nsf. don't think can single agent. if want jar files available single database, afraid way manually, either java library or directly agent. another possibility work if have access writing jar files directly 'magic' paths on both server and notes client. jvm/lib/ext however, there security issues involved because code in path considered absolutely safe , run without restrictions. if have godd admin, not happy , want have long @ code. ...