Posts

Showing posts from June, 2014

rails : Using params in another action -

i have 3 models, survey -> question -> answer related has_many/belongs_to , nested_form. i can params in create(post) action. "questions"=>{"11"=>{"answer"=>"40"}, "10"=>{"answer"=>"37"}, "9"=>{"answer"=>"31"}} i want show user's input in show(get) action. let's assume u taking online test. if u done it, u going submit form, , web server returns result page input. i thought save hashes in create action , use them in show action. searching google , stackoverflow, realized that's not idea. how can use params in show action? in create action you're presumably saving data in param database, why not call in show action? in controller: @questions = question.all in view: <% @questions.each |question| %> <h4><%= question.content %></h4> <% question.answers.each |answer| %> <%= a...

cordova - plugman not recognising project -

i've been following scandit's guide setting project in phonegap make use of library. so list of commands call are: cordova create . cordova platform add ios plugman install --platform ios --project . --plugin <path unzipped scanditsdk plugin ios> but on last command, throws error: does not appear xcode project (no xcode project file) does know how fix this? ran cordova build ios in case needed initiation, didn't it. maybe it's because haven't made custom additions bare structure yet? this using phonegap 3.0 if running plugman same directory called cordova platform add ios you need add path directory above command created ios project e.g. plugman --platform ios --project platforms/ios --plugin path-to-scanditsdk if have further questions, contact @ info@scandit.com.

Comapring two llvm:SmallPtrSet for equality -

i trying rewrite std::set usages llvm::smallptrset (fast set implementation based on small vector , iterating vector every operation). works, problem operator== - can compare 2 std::set objects , can't compare smallptrset object. how can compare 2 smallptrset s? smallptrset 's methods count() , erase() , ... compare objects memory address, not via equality defined in overloaded == operator. if need check equals instead of is same , suggest write small helper iterates on sets , checks equality constraints.

mysql - JSP - Read page's meta tag -

what need read in meta tag of html file (it's keyword meta tag) , wondering if possible jsp? need because accessing database, mysql search based off of keyword. possible? if so, know how? so mysql is: "select * db searchterm= [keyword meta tag]" if make own custom tag, outputs meta tag, can store value somewhere when tag run. edit that assumed meta tags on jsp page. if they're not (as indicated in comments), , need extract them external html file, you're going need html parser of sort (or ugly/unreliable regular expressions). might want try http://jsoup.org/ .

javaFX textarea - colums/rows -

the textarea-class in javafx should give me option add rows , colums, way tried didn't work: textarea ta = new textarea(); ta.setprefrowcount(100); ta.setprefcolumncount(100); i'm searching colums/rows in microsoft excel, inclusive gridines. .setgridlinesvisible(true); doesn't work type. any ideas? for use case similiar excel you're looking tableview . every table cell can contain anything, window flexible. if want grid lines on top of textarea, want keep standard textarea behavior, have combine textarea , tableview in stackpane . have clear table's background using css. however, matching row , column sizes text need additional code. apologies english.

c# - Creating .NET equivalent Colors static class in Mono Android (Xamarin.Android) -

a lot of canvas methods in android api require paint object defined in order define color. method doing is, paint mypaintobject = new paint(); mypaintobject.color = color.red; canvas.drawrect(..., mypaintobject); it better if looked this, canvas.drawrect(..., colors.red); a solution class might this... public static class colors { public static paint red { { return getcolors(color.red); } } public static paint black { { return getcolors(color.black); } } private static paint getcolors(color color) { paint paint = new paint (); paint.color = color; return paint; } } but suck have create getters every color available. ideas making easier? edit: linq pretty solution this. per @chrissinclair's comment regarding populate list solidcolorbrush brushes this.colors = typeof(color) .getproperties(system.reflection.bindingflags.static | system.reflection.bindingflags.public) .todictionary(p => ...

powershell - Add-Content With Condition On One Line -

i'm trying of on 1 line, try doesn't work. tried `b doesn't backspace line above. tried putting condition inline first add-content, didn't work either. add-content $txtpath "p: $strphone x $strxten | " if ($strmobile -ne $null) { add-content $txtpath "`m: strmobile | " } add-content $txtpath "$strfax" you can't use multiple add-content calls because each 1 append newline. logged suggestion long time ago nonewline parameter on add-content. can vote here . you can use stringbuilder , output contents via add-content or set-content: $sb = new system.text.stringbuilder [void]$sb.append("p: $strphone x $strxten | ") if ($strmobile -ne $null) { [void]$sb.append("`m: strmobile | ") } [void]$sb.append($strfax) add-content $txtpath $sb.tostring()

objective c - Where is the best place to define frame sizes for subviews? -

where programmers specify how big frames supposed be? tried put following code in instance variables section of .h file cgrect backbuttonrect = cgrectmake(2 * w/25, 18 * h/25, 6 * w/25, 2 * h/25); but won't let me reason. want put parameters in place that's easy remember can debug later. you cannot initialize instance variable in declaration. that's way objective-c is. it's different java or c# (or c++11) in regard. instance variables initialized zero. you didn't class contains instance variable. if you're loading object xib or storyboard, doesn't matter class is; initialized receiving initwithcoder: message. initialize backbuttonrect in initwithcoder: . example: - (instancetype)initwithcoder:(nscoder *)adecoder { if ((self = [super initwithcoder:adecoder])) { cgfloat w = 100, h = 64; backbuttonrect = cgrectmake(2 * w/25, 18 * h/25, 6 * w/25, 2 * h/25); } return self; } alternatively, if won...

datetime - How to get Timestamp with AM/PM in java -

i have date string , needs converted in time stamp am/pm . tried below way, i'm getting proper date format didn't in am/pm. can 1 please ? code snippet: string datestring = "10/10/2010 11:23:29 am"; simpledateformat sfdate = new simpledateformat("mm/dd/yyy hh:mm:ss a"); date date = new date(); date = sfdate.parse(datestring); system.out.println(new timestamp(date.gettime())); which gives me output below : 2010-10-10 11:23:29.0 but needs 2010-10-10 11:23:29.00000000 kindly me please. why create timestamp ? when can : simpledateformat sfdate = new simpledateformat("mm/dd/yyy hh:mm:ss a"); date date = new date(); date = sfdate.parse(datestring); system.out.println(sfdate.format(date) ); output: 10/10/10 11:23:29

arrays - Method return Java assignment -

okay here's java assignment i've been having trouble with. asked earlier , got comments , advice, have since understood assignment more , issue has changed bit. here's assignment: *** your task complete program below writing 3 methods (askinfo, copyinfo , setarray). program should ask integers (max 100 integers) until users types in zero. integers can vary 1 one hundred , stored in array has 100 elements. numbers asked askinfo method, receives array numbers parameter. method returns number of integers. number 0 not saved in array; merely used stop giving input. given numbers copied array size amount of given numbers. copying done copyinfo method receives both arrays parameters. after elements of new array put in ascending order setarray method , printed on screen printarray method. program complete: import java.util.*; public class revisionexercise { public static void main(string[] args) { int[] temparray = new...

java - best Alternative for InetAddress.getByName(host).isReachable(timeout) -

i trying reach host , have following code if(!inetaddress.getbyname(host).isreachable(timeout)){ throw new exception("host not exist::"+ hostname); } the hostname able ping windows, , did tracert on , returns packets. java throws out exception "host not exist::"; the timeout value experimented giving 2000ms, 5000ms. tried 3000 well. cause of problem not able understand. researched on net , inetaddress.getbyname(host).isreachable(time) not reliable , behaves according internal system. what best alternative if true. please suggest. either open tcp socket port think open (22 linux, 139 windows, etc.) public static boolean isreachablebytcp(string host, int port, int timeout) { try { socket socket = new socket(); socketaddress socketaddress = new inetsocketaddress(host, port); socket.connect(socketaddress, timeout); socket.close(); return true; } catch (ioexception e) { return false; ...

Scheduling a java program using another java program -

as part of automation want schedule java program after 12 hours using java program running. client machine windows. can't when first script start , once ends, has schedule second script should start after 12 hours. suggestions on how it? i use java.util.timer.schedule(timertask task, long delay). task schedule can invoke second java program appropriately. example: public void scheduletask() { timer timer = new timer(); timer.schedule(new timertask() { public void run() { try { runtime.getruntime().exec("java secondprog.class &"); } catch (ioexception e) { // todo auto-generated catch block e.printstacktrace(); } } }, 12*1000*60*60); }

c++ - Smart pointer: set by reference, reset, set null, null-check or reset-check -

for first time, i'm using smart pointers in c++. i've question std::shared_ptr : set pointer reference: mytoy mytoy_1, mytoy_2; set_mytoy(mytoy_1, some_data); set_mytoy(mytoy_2, some_data); shared_ptr<mytoy> ptr_mytoy(&mytoy_1); reset , new assignment: ptr_mytoy.reset(&mytoy_2); reset without assignment: ptr_mytoy.reset(); set null (?): ptr_mytoy(nullptr); are these examples right? how can check if smart pointer "empty" (for instance, after .reset() ) or if null ? are these examples right? the first 2 wrong: try initialise , reset shared_ptr object, not pointer. update : question has been changed initialise them pointers automatic variables. still wrong: shared_ptr want delete them, , it's error delete wasn't created new . usually, object created using new , although it's better use make_shared create you: // auto ptr = make_shared<mytoy>(); // not good, necessary mytoy * mytoy_2 = new...

c# - WebApi Filter Unity -

environement : unity , asp.net mvc webapi follow sample webpage http://www.asp.net/mvc/tutorials/hands-on-labs/aspnet-mvc-4-dependency-injection , after modifications, find way inject filter controler. i used code in boostrapper.cs var container = new unitycontainer(); container.registerinstance<ifilterprovider>("filterprovider", new filterprovider(container)); container.registerinstance<iactionfilter>("logactionfilter", new traceactionfilter()); i add class filterprovider public class filterprovider : ifilterprovider { private iunitycontainer container; public filterprovider(iunitycontainer container) { this.container = container; } public ienumerable<filter> getfilters(controllercontext controllercontext, actiondescriptor actiondescriptor) { foreach (iactionfilter actionfilter in this.container.resolveall<iactionfilter>()) { yield return new filter(actionfilter, f...

xml - android parse internal storage output -

i want parse internal storage output, nullpointerexception here errorlog: 08-20 18:32:49.089: w/system.err(1149): java.lang.runtimeexception: can't create handler inside thread has not called looper.prepare() 08-20 18:32:49.089: w/system.err(1149): @ android.os.handler.<init>(handler.java:197) 08-20 18:32:49.089: w/system.err(1149): @ android.os.handler.<init>(handler.java:111) 08-20 18:32:49.089: w/system.err(1149): @ android.app.activity.<init>(activity.java:759) 08-20 18:32:49.089: w/system.err(1149): @ android.support.v4.app.fragmentactivity.<init>(fragmentactivity.java:70) 08-20 18:32:49.089: w/system.err(1149): @ de.everhome.cloudbox.deviceactivity.<init>(deviceactivity.java:54) 08-20 18:32:49.089: w/system.err(1149): @ de.everhome.parser.sceneparseris.downloadurl(sceneparseris.java:77) 08-20 18:32:49.089: w/system.err(1149): @ de.everhome.parser.sceneparseris.parse(sceneparseris.java:109) 08-20 18:32:49.089: w...

delphi - Why don't the open and save dialogs show files matching the selected filter? -

i want open , save dialogs display xml files. have definition: // save dialog dlg := tsavedialog.create(nil); dlg.options := [ofoverwriteprompt]; dlg.title := 'seleccione la ubicación del archivo'; dlg.filter := 'xml | *.xml | todo | *.*'; dlg.defaultext := 'xml'; dlg.execute(); // open dialog dlg := topendialog.create(self); dlg.title := 'seleccione la ubicación del archivo'; dlg.filter := 'xml | *.xml | todo | *.*'; dlg.defaultext := 'xml'; dlg.execute(); but doesn't show xml files. show xml files in path, need choose "todo" (*.*) filter. why doesn't show files when xml filter selected? remove spaces around extension. dialog trying filter "*.xml " files, there's none. refer documentation examples.

c# - Receiving Webhook data -

so want receive webhook data service called chargify , have 0 knowledge of webhooks , have been looking around , see no common link in way receive type of data. specific api? how 1 go receiving data can manipulated 1 pleases? chargify's documentation here if helps answer question: documentation

in memory db hibernate spring -

i have been trying integrate between spring , memorydb in junit tests keep getting exception. org.hibernate.exception.sqlgrammarexception: user lacks privilege or object not found: ordertable testcontext.xml <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:jdbc="http://www.springframework.org/schema/jdbc" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-co...

move - How to use VBA to delete multiple xls files -

using vba access how delete multple xls files ? there 3 reports generated through process being saved documents folder. in same sense how move 3 of these files folder if didn't want delete them archive them? dim fso new filesystemobject fso.deletefile "c:\mydocs\*.xls" or fso.movefile "c:\mydocs\*.xls" "c:\archive\"

html - View PPT files directly in an iframe (with Chrome Office Viewer?) -

so working on local web-based application. here facts: i using css page transitions found here: http://tympanus.net/development/pagetransitions/ due this, each "page" of application contained in it's own div in single file. example: <div class="pt-page pt-page-1"> <!-- page 1 content goes here ... --> </div> <div class="pt-page pt-page-2"> <!-- page 2 content goes here ... --> </div> ...etc the client wants able view powerpoint (.ppt) files directly on web browser. attempt quick , dirty solution, have installed chrome extension "chrome office viewer" https://chrome.google.com/webstore/detail/chrome-office-viewer-beta/gbkeegbaiigmenfmjfclcdgdpimamgkj?hl=en each machine(this application going isolated 4 machines using chrome application, usability isn't issue here) what want have happen link .ppt file in iframe in 1 of <div> pages seen above, when user clicks on link view po...

c# - Runas admin (from batch script/cmd) not working properly -

i'm trying batch script run silent install of program. here's line that's causing trouble: runas /user:domain\admin /savecred start "" "%temp%\myprogram - 4.6.0.0\setup.exe" /silent >> %userprofile%\desktop\batchlog.txt a few notes: "" before file location there avoid issues spaces in location of setup.exe /silent parameter passed setup.exe run silent installation >> %userprofile%\desktop\batchlog.txt pipes output log file when run part of batch script, setup.exe isn't running domain\admin . sharepoint savvy, spfarm.local throwing null ref (it's written in c#), indicating running user doesn't have db access. can spot wrong use of runas here? running line command line pulls runas screen. i'd find out why that's happening well. if manually run (double-click) setup.exe (logged in domain\admin ) don't null ref , indicating program running domain\admin . how can fix line execute pro...

listview - Android Application - Searchable Spinner -

hi have spinner 934 items in , it's long, make worse it's become multiple select order of "him must obeyed". going have manually populate uneditable read-only "listview" below whenever picked, still doesn't make search spinner. what had in minds eye this ++++++++++++++++++++++++++++++++ + search text [v]+ ++++++++++++++++++++++++++++++++ + filtered choice 1 | |+ + filtered choice 2 | |+ + filtered choice 3 |i|+ ++++++++++++++++++++++++++++++++ + picked choice [delete] + + picked choice b [delete] + ++++++++++++++++++++++++++++++++ if aiming way high understand wondering if there projects or tutorials covering notion? help.

haskell - Why encode function in data type definition? -

i find hard intuition encoding function in data type definition. done in definition of state , io types, e.g. data state s = state s -> (a,s) type io = realworld -> (a, realworld) -- type synonym though, not new type i see more trivial example understand value possibly build on have more complex examples. e.g. have data structure, make sense encode function in 1 of data constructor. data tree = node int (tree) (tree) (? -> ?) | e i not sure trying here, example of function can encode in such type? , why have encode in type, not use normal function, don't know, maybe passed argument when needed? really, functions data else. prelude> :i (->) data (->) b -- defined in `ghc.prim' instance monad ((->) r) -- defined in `ghc.base' instance functor ((->) r) -- defined in `ghc.base' this comes out naturally , without conceptually surprising if consider functions from, say, int . i'll give them strange name: (re...

r - Custom UTM coordinates to ggmap -

on maps obtained osm/cloudmade etc using get_map , how 1 change projection custom utm coordinate using proj4/crs? can like pc0.1<- sptransform(pc0,crs("+proj=utm +zone=32 +datum=wgs84 +units=m +no_defs+ellps=wgs84+towgs84=0,0,0")) be used get_map or ggmap or ggplot in general? there way other changing utm match ll? thanks i have done when using library(openstreetmap) command openproj , i'm not sure if exists in ggmap library. found openstreetmap gave me more additional functionality ggmap .

oracle10g - How to edit and save stored procedure in Oralce toad? -

can please tell me how edit , save stored procedure in oralce using toad. thanks, r open schema browser, right-click on stored procedure, select "load in editor". make changes, click "execute/compile".

javascript - how to make and iframe appear and include it in joomla -

here's plot: have iframe hidden , situated in far left <iframe id="myframe" style="position:absolute;right:15;bottom:-10" style="visibility:hidden;" width="600" height="480" frameborder="0" align="right" scrolling="no"></iframe> i have javascript function dynamically make iframe visible , update it's src <script> function showframe(id) { var iframe = document.getelementsbyid('myframe') iframe.style.display='block' } switch(id) { case "001": iframe.src= "www.google.com" case "002": iframe.src= "www.yahoo.com" } </script> and link like <a href="#" id="001" onclick="showframe(this.id);"> first site </a> <a href="#" id="001" onclick="showframe(this.id);"> second site </a> i'm trying make work in joomla, ive ...

regex - How to stop a sed script if finding two start patterns before an end pattern? -

i need find revisions in subversion dump have changes pom.xml. i'm using svndumptool print revisions, , sed filter findings. i'm able match revision number start, need able throw away if find second matching start before find stop. here command i’m using: svndumptool=~/path/to/svndumptool.py target=specificsvn.dump # use svndumptool read svnlog target stdin | # sed matches start -r[0-9], such -r103, ends on pom.xml # redirects stdout > log file target $svndumptool log $target -v | sed -n '/r[0-9]/,/pom.xml/p' > $target.log considering log of this: -r0 | ... | ... changed paths: none; initialization of repo; not match -r1 | ... | ... changed paths: ... not matches here -------- -r2 | ... | ... changed paths: ... nor here -------- -r3 | ... | ... changed paths: pom.xml -------- -r4 | ... | ... changed paths: pom.xml -------- -r5 | ... | ... ...

.htaccess - Remove From .PHP from the URL? -

this .htaccess file: rewriteengine on rewriterule ^(.*)/$ /$1 [l,r=301] rewritecond %{request_filename} !-f rewritecond %{request_filename}.php -f rewriterule ^(.*)$ $1.php [nc,l] when user goes http://local/home , works fine, if user goes http://local/home.php , .php stays there, doesn't redirect page without .php , don't mark duplicate have researched it. you don't have rule redirects request php extension redirect without it. that's why stays there. because you've added rule internally rewrite request missing php extension doesn't mean magically happens in other direction. @ top of rules need match against actual request , redirect browser when requests php file: rewritecond %{the_request} ^(get|head)\ /(.+)\.php(\?|\ ) rewriterule ^ /%2 [l,r=301] more: htaccess remove php extension , redirect index htaccess removing extensions redirect .php urls urls without extension just matter of recognizing rule 1 thing asked do, match pat...

python - tkinter button press to function call -

hey guys first post , not hi. anyway trying make scientific calculator tkinter , im not it(and python second proper assignment). anyway of code wrong im trying take 1 step @ time in particular im concerned function add. im calling via button want pass function +. in turn creating array can calculate from. keeps erroring , dont know how fix it. annoying me if out appreciated from tkinter import* operator import* class app: def __init__(self,master):#is master button widgets frame=frame(master) frame.pack() self.addition = button(frame, text="+", command=self.add)#when clicked sends call + self.addition.pack() def add(y): do("+") def do(x):#will colaborate of inputs cont, = true, 0 store=["+","1","+","2","3","4"] in range(5): x=store[0+i] print(store[0+i]) cont = false if cont == fal...

url rewriting - Isapi Rewrite not working, query string mod -

if hypothetically typed in: http://www.domain.com/items-shopping-shoe-2013 my website needs see: http://www.domain.com/items.asp?cc=shoe-2013 so, thought pretty simple.. i edited httpd.ini helicon isapi rewrite this: rewriterule ^(.*?.com/)items-shopping-([a-za-z0-9-]+)?$ $1items.asp\?cc=$2 although patern matches, doesn't work. i newb regex expressions , isapi rewrite..probably pretty obvious :p try following in isapi_rewrite 3 .htaccess: rewritebase / rewriterule ^items-shopping-(.+)$ /items.asp?cc=$1 [nc,l] for isapi_rewrite 2 be: rewriterule /items-shopping-(.+) /items.asp\?cc=$1 [i,l]

jquery - How do I make this JavaScript work on my local machine? -

the code have below works if it's on server when viewed on local machine gives me following errors: referenceerror: jquery not defined $(document).ready(function() { default.html (line 24) referenceerror: $ not defined $(document).ready(function() { default.html (line 12) referenceerror: $ not defined $(document).ready(function() { code: <script src="//code.jquery.com/jquery-latest.min.js"></script> <link rel="stylesheet" href="slider/site/style.css"> <script type="text/javascript" src="slider/src/unslider.js"></script> <script type="text/javascript"> $(document).ready(function() { var unslider = $('.container').unslider(); $('.arrow').click(function() { var fn = this.classname.split(' ')[1]; // either unslider.data('unslider').next() or .prev() depending on classname unslider.data('unsl...

excel - Create a macro that is executed when a cel value chages (not by the user) -

ok have worksheet "goal 0" ranges, make calculations like... (in a1) =sum(g2:g68)*i17 then if add/modify of values in 62-g68, cell auto calculated (numbers negative , possitive). the objetive is: according sum of range, find value of i17 result of a1 equal or more 0. (starting 0, incrementing 1 1, decimals not needed) manually can add change i17 untill reaches goal. how ever want make automatically, if value in range of g2 g68 changes recalculate value of i17, untill (a1 calculation gets value equal or higher 0) if higger or equal 0 nothing. hope explain well edit: created code ... function increasethevalue() if range("a1") < 0 range("i17").value = 0 while range("a1").value < 0 range("i17").value = range("i17").value + 1 loop end if end function and works perfect, how ever not fires when make chage. how do that... i try adding in a2 cell did not worked...

linux - Undefine reference for libraries, so How could I find the right path? -

i trying compile v4l2 example in ubuntu getting following error: guilherme@notedev01:~/downloads/v4l2_samples-0.4.1$ make gcc -o2 -l/usr/include -lx11 -lxext -o viewer viewer.c /tmp/ccujnjwq.o: in function `image_destroy': viewer.c:(.text+0x234): undefined reference `xdestroyimage' viewer.c:(.text+0x256): undefined reference `xfreegc' viewer.c:(.text+0x277): undefined reference `xshmdetach' viewer.c:(.text+0x2ac): undefined reference `xfreepixmap' /tmp/ccujnjwq.o: in function `image_create': viewer.c:(.text+0x305): undefined reference `xcreategc' viewer.c:(.text+0x31d): undefined reference `xgetwindowattributes' viewer.c:(.text+0x39e): undefined reference `xshmcreateimage' viewer.c:(.text+0x3f5): undefined reference `xshmattach' viewer.c:(.text+0x44e): undefined reference `xcreateimage' viewer.c:(.text+0x494): undefined reference `xshmqueryextension' viewer.c:(.text+0x4b4): undefined reference `xshmpixmapformat' viewer.c:(.text...

android - What is the meaning of "ITEM_ID_LIST"? -

at code below, meaning of "item_id_list". i don't know replace this..."item_id_list" arraylist skulist = new arraylist(); skulist.add("premiumupgrade"); skulist.add("gas"); bundle queryskus = new bundle(); queryskus.putstringarraylist(“item_id_list”, skulist); it works string id identify arraylist - "skulist". can replace name of choice.

google apps script - Need a way to parametize an array sort function, with parameters set in a handler -

i'm writing web app displays subset of rows spreadsheet worksheet. convenience of users, data presented in grid, each row selected spreadsheet forms row in grid. number of rows relevant each user grows on time. the header of grid set of buttons, allow user control sort order of data. if user clicks button in header of first column, array populates grid sorted first column , forth. if click same column button twice, sort order reverses. i used script properties communicate selected sort field , order between handler responding button presses, , order function called sort. so in doget(): // sort field , order scriptproperties.setproperties({"sortfield": "date","sortorder": "asc"}); and in button handler: function sorthandler(event) { var id = event.parameter.source; if (id === scriptproperties.getproperty("sortfield")) { scriptproperties.setproperty("sortorder", (scriptproperties.getproperty("sort...

Magento Payment methods in admin panel gone missing -

Image
after re-installing paypal module, our payment methods screen went weird, , have no idea how fixed. reloaded entire /app/design/adminhtml/ folder original magento compressed files used install it, still, no luck. the block supposed come when click on "configure" button paypal express checkout. the block supposed show has empty html elements in it, guess block not being rendered somewhere. i copied across entire /app/design/adminhtml folder similar install, /skin/adminhtml. screen looks this: how can fix problem? is layout issue, design issue, data, or missing template files somewhere? it should this: thanks in advance help. a few things try (obviously disable caching/apc/compilation/minification of js,css/etc.): logs & developer mode first enable developer mode via .htaccess setenv or uncommenting flag in index.php . ensure logging enabled via admin. system->configuration->developer->log settings. check var/logs/ existing exce...

Converting JSON to a MySQL table, how should the table structure look like? -

the following json file... { "name":"magic 2014 core set", "code":"m14", "releasedate":"2013-07-19", "border":"black", "type":"core", "cards": [ { "layout":"normal", "type":"creature - human warrior", "types":["creature"], "colors":["red"], "multiverseid":370735, "name":"academy raider", "subtypes":["human","warrior"], "cmc":3, "rarity":"common", "artist":"karl kopinski", "power":"1", "toughness":"1", "manacost":"{2}{r}", ...

Add array object to array php? -

i have array object looks , stored in variable $named_array array ( [results] => array ( [0] => array ( [date] => 2013-15-6 [position] => 5 [person] => john ) [1] => array ( [date] => 2013-15-6 [position] => 3 [person] => alex ) ) ) another array called $post wordpress post object array called $posts = get_posts(array(.... have foreach each loop $post being variable. within foreach loop i've tried following combine arrays it's not working. $combineddata = array_merge($post, $named_array); print_r($combineddata); i can see post object arrays print_r($post); within foreach loop named_array. what's correct function add named_array post array? thanks $posts mentioned, array of objects $post obj...

how to shrink KVM hard drive image -

when copy hd image 1 machine one, file become full size. possible shrink actual size? have google lot nothing found. hope give me clue. thanks! leo images can sparsed, , cp might not respect various reasons. would: check real file usage (du -sh vm.img or qemu-img info vm.img) use qemu-img convert -s recreate sparse image convert qcow2 have growing , versatile image instead

Diameter protocol CCR request not routable -

i using jdiameter stack http://i1.dk/javadiameter/ diameter implementation. initial cer request goes through fine on sending ccr request error "not routable". can me out this?. looking build diameter call charging client , have gone through mobicents, unable started on same due lack of basic tutorials how go it. p.s. there similar question posted time failed resolve query. did try following mobicents diameter example https://code.google.com/p/sipservlets/wiki/diameterrorf ?

android - MediaPlayer is not playing sound -

i creating media player. when press button (play) shows error. 08-20 11:35:21.473: d/mediaplayer(775): couldn't open file on client side, trying server side 08-20 11:35:21.493: e/mediaplayer(775): error (1, -2147483648) 08-20 11:35:21.503: w/system.err(775): java.io.ioexception: prepare failed.: status=0x1 my code btnplay.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { uri audio = uri.parse("android.resourse://vishesh.mediaplayer/res/drawable/jannat"); try { mp.setdatasource(play.this,audio); mp.prepare(); mp.start(); } catch (illegalargumentexception e) { e.printstacktrace(); } catch (securityexception e) { e.printstacktrace(); } catch (illegalstateexception e) { e.printstacktrace(); } catch (ioexception e) { e.prints...

python - Download functionality in Tornado? -

i new tornado web framework. can 1 tell me how download file through web browser using tornado framework. tornado comes both synchronous , asynchronous http client. can find documentation here . here's synchronous example taken page linked above: from tornado import httpclient http_client = httpclient.httpclient() try: response = http_client.fetch(url) print(response.body) except httpclient.httperror e: print("error:", e) http_client.close() if want save resulting output disk instead of printing data, write out file. note in python 3, tornado returns response bodies strings: with open(output_file_name) f: f.write(response.body) of course, if response data large, you'll want download file in chunks , write disk on-the-fly ( see here ). finally, if you're not constrained tornado reason, highly recommend requests library (or grequests asynchronous calls). edit: serve static file download, in handler's get : def get(s...

wordpress paginate_links all pages same result -

i try make own search form on wordpress site. result want no problem, can't paginate_links working. i tested in , output parameters wp_query , seems oke. input paginate_links 775 results, give 16 page's 50 product titles. the problem: pages give same result page 1. did ready done: posted wordpress forum hint's @ 3days. tested parameters. merged get_col reflect wp_query add_hook. checking permalink , paged. global $wpdb; $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; if ($paged == 1) { $limit = "50"; } else { $firstpage = ($paged-1)*50; $lastpage = $paged*50; $limit = $firstpage.",".$lastpage; } $term = get_term_by('name', $_request["product_cat"], 'product_cat'); // echo "id". $term->term_id; $mypostids = $wpdb->get_col("select * $wpdb->posts, $wpdb->term_relationships $wpdb->posts.post_title ...

Binding objective-c library to Xamarin Project using Objective Sharpie -

Image
i developing ios application using xamarin studio. application going work infinite peripherals linea pro 5 (a barcode scanner attache ipod/iphone). linea sdk provided infinite peripherals objective-c library associated header file. i've followed xamarins ios binding tutorial , skipping first parts , starting @ chapter "3.2. create xamarin.ios binding project" (since have fat binary file). have installed objective sharpie v0.4.11 , xcode command line tools. when try create binding using objective sharpie following error message: after research find bug caused objective sharpie, there way around bug? need library in monotouch project. p.s. have checked out the tutorial david sandor , outdated , not possess enough knowledge update it. if objective-sharpie doesn't work project, can: do manual binding, or build upon david sandor's one. that's not that hard. try find offending part of header file, removing part of , process obj-sharpie (th...

cocoa - Copies of NSRects not displaying -

i trying make simple cocoa program. have little black box (a subclass of nsview drawing nsrect on screen) following mouse around. part have working. need is: when click mouse want leave "copy" of black box behind. i have been trying work on 5 hours , have tried under sun. sure solution simple, guess missing grasping of fundamental concepts. here have (a "stay" supposed copy stays behind): @property nsmutablearray *stays; ... - (void) makestay { if (!_stays) _stays = [[nsmutablearray alloc]init]; nsvalue *newstay = [nsvalue valuewithrect:self.frame]; [_stays addobject:newstay]; } ... -(void)drawrect:(nsrect)rect { [[nscolor blackcolor] set]; nsrectfill([self bounds]); (int x = 0; x < _stays.count; x++) { nsrectfill([_stays[x] rectvalue]); } } any on how understand fundamentals of nsview work appreciated! from code i'm guessing problem bounds. it looks have nsview moving around screen - ...