Posts

Showing posts from May, 2015

ios - UIScrollview not recognizing swipe from screen edge -

i have uiview containing uiscrollview . have set uiview header view of uitableview . uitableview 20px narrower screen have seit header view fit screen size. the problem having cant swipe uiscrollview coming in screens edge on both sides. start paging when touch inside of screen. is there way fix this? lot! just fix by self.automaticallyadjustsscrollviewinsets = no; put line in viewdidload method , create other controllers. it's working on ios 7 , latter.

c - Using 8-1 Multiplexer with atmega16 -

i trying use 8-1 multiplexer @ mega16 trying maximize input pins made program scan addresses of multiplexer , listen interrupt if interrupt happens program check address sent @ moment print string on lcd (and managed switch case) ... the problem is :: when interrupt happens in switch case , execute cases under 1 starts on ex : if pressed first button(first address) execute cases, if pressed second 1 execute it' case , third case ans on int main(void) { ////////////////////// setmusk(mcucr,isc01); /* when(isc01 =1 , isc00 =0 )the falling edge of int0 generates interrupt request. can use internal pull resistance*/ clearmusk(mcucr,isc00); /////////////////////// gicr = 0x40; clearmusk(sfior,pud); //enabling pull resistor ddrc = 0xff; lcd_init(); ddrc = 0xff; ddra = 0xff; ddrd = 0x00; lcd_send_command(clear_display_and_ram); lcd_display_string("program starting !!");

c# - How to test if an object is disposed and GC'ed? -

i'm writing code delete object , wanted have unit test ensure object deleted. best way this? if gc work should not holding references how can test without reference? there no way test if object disposed in general case. weakreference thing looking for. can create weakreference part of test , after code has run this: weakreference wr = new weakreference(obj); gc.collect(); assert.istrue(!wr.isalive);

php symlinks not creating -

i trying create symlink target directory outside script root , link inside folder in script: if(!file_exists('properties')) { symlink('/hermes/bosnaweb03a/b1456/nf.comcan/public_html/properties' , __dir__.'/properties'); var_dump( file_exists('/hermes/bosnaweb03a/b1456/nf.comcan/public_html/properties')); var_dump( is_dir('/hermes/bosnaweb03a/b1456/nf.comcan/public_html/properties')); } both var_dumps return true. not creating symlink error no such file or directory. doing wrong here please you have permission error. try shell command ln -s /hermes/bosnaweb03a/b1456/nf.comcan/public_html/properties , {php_script_location}/properties' with same user running script. if can't create file, need run user have permission create file, or can change permissions on location more permissive.

java - Why does processing try-catch without any exception thrown not slow down the program at all? -

today realized appeared weird me: noticed when do try { dosomething(); } catch (exception e) { } it isn't slower @ if do dosomething(); so ran test , wrote down quick code prove saw, code loops on function called dosomething() lots of times, 1 time without , 1 time try-catch surrounding it. here's code if want test yourself: public class main { private static final long loops = 1000000l; public static final void main(string[] args) { system.out.println("loop without try catch: "+loopwithouttrycatch(loops)); system.out.println("loop try catch: "+loopwithtrycatch(loops)); } public static long loopwithouttrycatch(long loops) { long starttime = system.currenttimemillis(); (long = 0l; < loops; i++) { dosomething(); } return system.currenttimemillis()-starttime; } public static long loopwithtrycatch(long loops) { long starttime = system.currenttimemillis(); (long = 0l; < loops; i++)

PHP/Ajax not updating mysql -

i have code use insert data database , works fine im trying adapt update mysql row butitdoes not work. header <script type='text/javascript'> function bet_game(id) { var result = confirm ("do want update bet?"); if (result) { bet_games(id); } } function bet_games(id) { if (window.xmlhttprequest) xmlhttp=new xmlhttprequest(); else xmlhttp=new activexobject("microsoft.xmlhttp"); xmlhttp.onreadystatechange=function() { if (xmlhttp.readystate==4 && xmlhttp.status==200) { if (xmlhttp.responsetext !="") { alert (xmlhttp.responsetext); document.getelementbyid(id).style.display="none"; return true; } } } gid = id.replace('tbl_',''); ml_team = document.getelementbyid('ml_team'+gid).value; ml_points = document.getelementbyid('ml_points'+gid).value; ou_team = document.getelementbyid('ou_team'+gid)

asp.net - error in server when useing telerik:RadAsyncUpload for upload picture in my web site -

this code <telerik:radasyncupload runat="server" id="radasyncupload2" allowedfileextensions="jpg,jpeg,png,gif" onfileuploaded="radasyncupload2_fileuploaded" onclientvalidationfailed="validationfailed" skin="outlook" inputsize="30" temporaryfolder="" multiplefileselection="automatic"> <localization cancel="انصراف" remove="حذف" select="انتخاب" /> <filefilters> <telerik:filefilter description="*.jpg; *.jpeg; *.png; *.gif" extensions="jpg,jpeg,png,gif"></telerik:filefilter> </filefilters> </telerik:radasyncupload> in computer code run correct full permission folder in host string path = server.mappath("~/image/pic_news/"); but when uploading picture in host cannot upload picture . what should do? can please set allowedfileextensions prop

iframe - casper won't load dynamic frame because of bind -

i have page frame in it. frame loaded same (currently: localhost) server. however, after frame loaded, page suppose load content frame (happens in every browser) not happening in casper. i'll list in simple steps: page loading frame loading page loading content frame this last step, step 3 missing. waiting 5 seconds didn't help, every screen capture coming empty frame is. i've used withframe method, , did frame, won't fill (got loaded code, not full code appears after in every browser). after using error checking, seems casper not recognize bind() method. i've tried inject bind prototype so: if (!function.prototype.bind) { console.log('bind injecttor 1'); function.prototype.bind = function (othis) { console.log('bind injecttor 2'); if (typeof !== "function") { console.log('bind injecttor error'); // closest thing possible ecmascript

vb.net - how to get the item from listview to another listview? -

Image
how thing i've been struggling thing night long, want item listview listview. like, when select item list view 1 can total liters of list view 2.

objective c - iOS 7 content shifting up by 20 points due to transparent statusbar -

Image
ever since have upgraded ios 7, content have shifted 20 points up, , cant seem fixed. have looked elsewhere on ways shift content down, adjusting window, view, none seem affect content views. can please tell me views shifted down. here screenshots: notice window red background colour showing through @ bottom: notice how pattern repeats @ bottom of login page: if project doesn’t use auto layout, issues caused status bar differences between ios 6 , ios 7 can resolved using springs, struts, , ios 6/7 deltas. solution move content down 20px content wasn’t under status bar in ios 6. to remedy this, use ios 6/7 deltas set negative y delta, equal number of points moved content down ios 7. example, if moved content down 20 points ios 7, set y delta of -20 points. follow link correct direction per code. hope lot. good luck.

android - getTypeName() of NetworkInfo returns mobile eventhough connected to WIFI on mobile device -

this question has answer here: how compare strings in java? 23 answers in following code, activeinfo.gettypename() returns mobile when connected wifi. read somewhere wifi not detected on emulator tried on device. still returns either mobile - when connected wifi or mobile data (i tried turning off mobile data , using wifi instead of turning on both)- , "not connected" when turn off both wifi , mobile data. connectivitymanager conmgr = (connectivitymanager)getsystemservice(context.connectivity_service); networkinfo activeinfo = conmgr.getactivenetworkinfo(); wifimanager wifi=(wifimanager) getsystemservice(context.wifi_service); log.e("sometag", activeinfo.gettypename()); string ssid; if(activeinfo!=null && activeinfo.isconnected()) { //eventhough following comparison wrong, next else should return "wifi"

python - How to write a sampling algorithm from a custom distribution? -

i'm generating random galaxies line of sight velocities drawn normal distribution , , random positions 2d gaussian . little more physical draw these positions nfw profile given by: rho(r) = rho_0/(r/r_s*(1+r/r_s)^2 where rho_0 , r_s constant parameters. how can write algorithm sample distribution ? basically i'm trying plop down couple hundred galaxies follow density distribution. i've been using numpy.random.normal sample gaussians , i'd sample nfw profile rather gaussians . i'm sure stats training place start, point in right direction helpful , appreciated. assuming have function rho(r), takes values [0..1] , returns values [0..1], it's pretty easy: def getrhosample(): #get uniform random number value = numpy.random.random() #sample custom function return rho(value)

c++ - libmysqlcppconn.so.5: cannot open shared object file: No such file or directory -

i built simple c++ application using netbeans on ubuntu. in application use mysql_connection , curl. application working fine on local system (ubuntu) when tried run application on centos server message: error while loading shared libraries: libmysqlcppconn.so.5: cannot open shared object file: no such file or directory. tried check if libmysqlcppconn.so.5 library exists on server or not found there following: remote (centos) **in [/usr/local/lib]** libmysqlcppconn-static.a libmysqlcppconn.so@ libmysqlcppconn.so.7@ libmysqlcppconn.so.7.1.1.3* local (ubuntu) **in [/usr/lib]** libmysqlcppconn-static.a libmysqlcppconn.so@ libmysqlcppconn.so.5@ libmysqlcppconn.so.5.1.1.0* why can't application run? how can fix it? you should build , package server. your application linked against different (incompatible) version of 1 of libraries uses. imho simplest build on box going run on.

java - Don't create a new CSV file each time -

so trying make work each time use method (which found on internet) creates new csv file, want add data each time, without removing there. public static void generatecsvfile(string sfilename) { try { nummers = nummer.gettext(); locatiess = locatie.gettext(); logins = login.gettext(); nummer5s = nummer5.gettext(); nummer1s = nummer1.gettext(); datums = datum.gettext(); filewriter writer = new filewriter(sfilename); writer.append(nummers); writer.append(';'); writer.append(locatiess); writer.append(';'); writer.append(logins); writer.append(';'); writer.append(datums); writer.append(';'); writer.append(nummer1s); writer.append(';'); wr

html - Slide out panel? -

i'm working on little project , have panel down, change "tab" position http://s26.postimg.org/5tr23ln9l/little_text.png hope can me, loves, bit of "newbie" here~ http://jsfiddle.net/2yhzt/ #purple { -webkit-border-radius: 4px;-moz-border-radius: 4px;border-radius: 4px; text-align: center; font-size: 11px; position:fixed; left:-50px; -webkit-transition: .5s ease-in-out; -moz-transition: .5s ease-in-out; -o-transition: .5s ease-in-out; x-index:999; } i think there wrong part; demo css #purple { -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; text-align: center; position:fixed; height:10px; left:-50px; -webkit-transition: .5s ease-in-out; -moz-transition: .5s ease-in-out; -o-transition: .5s ease-in-out; x-index:999; } #purple:hover { left:0px; } #purple:hover > div { display: inline-block; } #red { font-size: 11px; background: #fefefe; border:1px so

tesseract - Why is my PNG resolution with Ghostscript not what I specified? -

i using following command in ghostscript: gs -dsafer -sdevice=png16m -ddointerpolate -dgraphicsalphabits=4 -dtextalphabits=4 -dnumrenderingthreads=8 -ddevicewidthpoints=612 -ddeviceheightpoints=792 -r600 -o ./test_gs/output_%d.png -c 30000000 setvmthreshold -f ./test_gs/input.pdf input.pdf 8.5''x11'' pdf looks crisp , clear. resulting png's gs produces don't good, acceptable. problem noticed though that, though i'm specifying 600 resolution ("-r600"), imagemagick's identify reporting resolution of 236.22: geometry: 5100x6600+0+0 resolution: 236.22x236.22 print size: 21.59x27.9401 units: pixelspercentimeter type: grayscalealpha base type: grayscalealpha why this? , how can fix dpi higher (at least 300) use tesseract? which version of ghostscript using ? can find copy of pdf examine ?

javascript - List jQuery elements listening for a trigger. -

how find out elements on page listening jquery event? i'm trying write script move tiles on site: http://threesjs.com/ . tried send keypress event arrow keys, didn't work: $('*').trigger(jquery.event('keypress',{which:$.ui.keycode.up})); and: var e=jquery.event('keypress'); e.which=39; $('*').trigger(e); the tiles move when arrow keys on keyboard pressed, , should sending keypress elements, board doesn't react when executing in console. think best way trigger board movement find out element listening key down event. a better way manually triggering jquery events pull out handlers callable functions. this: function handlearrow(direction){ // code here } // handlers keypress $(document).on('keypress',function(){ var direction = /*find out key*/; handlearrow(direction); }); // manual trigger handlearrow('left'); (insert standard globals , namespacing warning here) :p

How to pass data between def - python -

i unsure if going right way advice ace ! basically have code : def recvcell(sock, waitfor = 0): while true: hdr = sock.recv(3) circid, cmd = struct.unpack(">hb", hdr[0:3]) ln = 509 if cmd == 7 or cmd >= 128: ln = struct.unpack(">h", sock.recv(2))[0] pl = sock.recv(ln) if cmd == waitfor or waitfor == 0: return { 'circid': circid, 'cmd': cmd, 'len': ln, 'pl': pl} # builds cell def buildcell(circid, command, payload): cell = struct.pack(">hb", circid, command) if command == 7 or command >= 128: cell += struct.pack(">h", len(payload)) else: payload += "\x00" * (509 - len(payload)) cell += payload return cell # builds version cell's payload def buildversions(acceptversions): pkt = '' v in acceptversions: pkt += struct.pack(">h", v

How to show multiple rows of SQL queries in MySQL Workbench UI? -

now, question isn't mysql queries, result rows or related databases itself, program mysql workbench. i have tens of tables open (both altering table , editing rows/columns) in program , can see around 10 tabs in ui @ once there 1 row of them. using left , right arrows show more tabs slow , annoying. so, there way show multiple rows of tabs or somehow otherwise increase space them? preferences have nothing related except font , searching web returns meaningless stuff. no. however, might want file feature request requests adding "scripting editor tabs" under preferences --> appearance --> fonts. also, it's worth noting [control] + [tab] key shortcut selects next tab, , [control] + [shift] + [tab] selects previous tab.

javascript - Timezone Conversion moment js -

i have requirement convert (utc/gmt) time local time based on timezone string provided user using moment js. eg: utctime = "2014-06-09t05:36:06.005z" timezone = "5.5" (indian standard time) expected result = "2014-06-09 11:06" i have tried code achieve this var local_date = moment.utc("2014-06-09t05:36:06.005z").zone("+05:30").format('yyyy-mm-dd hh:mm'); console.log('local date', local_date); // 2014-06-09 11:06 here getting correct result. have put time zone in +05:30 format when put "5.5"(timzone format getting user side) not working @ all. am getting user time zone following way -12, -11, .... -1 gmt 1, 2 .. 3.3, 5, 5.5, 5.75 ... is there way convert gmt time local using above timezone format. please guide me in right direction. if not possible how can covert user input time zone desired format. thank you this may http://jsfiddle.net/8qtfy/ var yourvalue=parsefloat("5.5&q

sql - SQLite select statement pulls all values although it is not supposed to -

i have these 3 tables: create table "item" ( "itemid" integer primary key , "itemname" varchar(25), buyerid integer references buyer(buyerid), sellerid integer references seller(sellerid) ); create table buyer( buyerid integer primary key unique not null, fname varchar(25), lname varchar(25), itemid integer, foreign key (itemid) references item(itemid) ); create table seller( sellerid integer primary key unique not null, fname varchar(25), lname varchar(25), itemid integer, foreign key (itemid) references item(itemid) ); item table has: 1|poly|1|1 2|jute|2|2 3|salt|3|3 buyer table has: 1|buyer1|polybuyer|1 2|buyer2|jutebuyer|2 3|buyer3|saltbuyer|3 sellertable has: 1|seller1|polyseller|1 2|seller2|juteseller|2 3|seller3|saltseller|3 now want select query want itemname , first , last names of relevant buyers , sellers. suppose want list of buyers , sellers salt. query: select buyer.fnam

c# - Change object's color inside existiong PDF with iTextSharp -

major part of job automation of engineering process, have create simple program, compares 2 different version of 1 drawn element, overlapping drawings, in order review differences. drawings represent single sheet pdf files. i'm using .net framework , c# 4.5; itextsharp library editing pdf files; initially, i'm getting 2 files, read them , create third one, contains result; var file1 = "file1.pdf"; var file2 = "file2.pdf"; var result = "result.pdf"; using (stream f1stream = new filestream(file1, filemode.open)) using (stream f2stream = new filestream(file2, filemode.open)) using (stream resultstream = new filestream(result, filemode.create, fileaccess.readwrite)) using (pdfreader f2reader = new pdfreader(f2stream)) using (pdfreader f1reader = new pdfreader(f1stream)) { pdfstamper pdfstamper = new pdfstamper(f1reader, resultstream); pdfcontentbyte pdfcontentbyte = pdfstamper.getovercont

Call methods from Swift initializer -

let's have following class in swift (which has obvious problems) class myclass { let myproperty: string init() { super.init() self.setupmyproperty() } func setupmyproperty() { myproperty = "x" } } this overly simplified i'm trying delegate initialization of myproperty setupmyproperty() method. it's pattern use break down different parts of setup of class. but of course, can't call self until super initializer has run, , can't run super initializer until properties have been set, i'm in catch 22. on top of since setupmyproperty() isn't considered initializer, won't able assign myproperty anyway. can tell me how implement pattern in swift? declare implicitly unwrapped optional class myclass : nsobject { var myproperty: string! init() { super.init() self.setupmyproperty() } func setupmyproperty() { self.myproperty = "x"

visual studio - WebEssentials 2013 has stopped creating css files from less files -

i'm using web essentials 2013 update 2 visual studio 2013. for reason it's stopped creating css files when i'm creating/saving less files. what can issue ? tried looking @ web essentials settings didn't find can bring making css files when saving less file check tools > options > web essentials > less compile files on save = true

android - Google glass development - Store an array of taken photos and videos -

i have working code saving spoken text array of strings: @override protected void onactivityresult(int requestcode, int resultcode, intent data) { if (requestcode == speech_request && resultcode == result_ok) { list<string> results = data.getstringarraylistextra( recognizerintent.extra_results); spokentext = results.get(0); if(strarray.length>arraykey){ strarray[arraykey]=spokentext; arraykey++; } } i want same not spoken text, photos , videos took. example, take photos using this: private void takepicture() { intent intent = new intent(mediastore.action_image_capture); startactivityforresult(intent, take_picture_request); } how can store photos , videos captured glasses each time after take them array? obviously, need add "if" case onactivityresult(), know parallel of speech_request in photos , v

elasticsearch - How to use multiple index analyzers in NEST? -

i have company type i've created. inside of company type have field called "summary". how can add multiple index analyzers field? i briefly looked using yakaz plugin, doesn't appear can use nest. the reasoning behind users search company names period in query, other times won't include period. i'd partial match using ngrams on both company name , without punctuation. i'm using stopwords filter remove punctuation. properties of summary field(having multiple index analyzers throws error): [elasticproperty(indexanalyzer = "partial_match", indexanalyzer = "partial_match_no_punctuation", searchanalyzer = "full_match")] public string summary { get; set; } mapping: private static void createmapping(elasticclient client) { var partialmatchnopunctuation = new customanalyzer { filter = new list<string> { "standard", "lowercase", "asciifolding", "punctuation_fil

ubuntu - Why can I not open rabbitmq management console -

i have installed rabbitmq-server on ubuntu vps server , have enabled rabbitmq_management plugin. after , when try open management console ( http://<vps server ip> :15672) , browser cannot open page. i have looked open port on server, there open port number 15672 tcp 0 0 0.0.0.0:15672 0.0.0.0:* listen - tcp6 0 0 :::5672 :::* listen - tcp6 0 0 :::80 :::* listen - unfortunetly , can not find problem. helping restart rabbitmq service, , try again. sudo service rabbitmq-server restart

javascript - onMessage.addListener Not Firing -

i can't chrome.runtime.onmessage.addlistener fire no matter examples copy/paste around web, when break them down can. right using: background js chrome.runtime.oninstalled.addlistener(function() { var context = "selection"; var title = "tm"; var id = chrome.contextmenus.create({ "title": title, "contexts":[context], "id": "context" + context }); }); chrome.contextmenus.onclicked.addlistener(onclickhandler); function onclickhandler(info, tab) { chrome.windows.create( {url : 'url here'}, function(window) { chrome.tabs.query({active: true, currentwindow: true}, function(tabs) { chrome.tabs.sendmessage(tabs[0].id, {greeting: "hello"}); }); } ); }; content script chrome.runtime.onmessage.addlistener( function(request, sender, sendresponse) { console.log('onmessage fired'

Non-reproduceable build fail with gradle-android-test-plugin -

i'm using gradle-android-test-plugin in one of projects . on 3 of 4 machines, ./gradlew --daemon test successful. on other fails. the build.gradle located here , .travis.yml here here . machines have similar configurations: differences find are different linux kernels different java build names (i.e. "archlinux build 7.u55_2.4.7-1-x86_64") after asking on project's site , recommended compare environment configurations , ask here. not know issue comes from: a bug in code incl. build.gradle an environment configuration (<-- one) a bug in plugin or gradle because ./gradlew --daemon test command shows behaviour (the other behave consistent on different pcs), don't know further. stacktrace below causes build fail: java.lang.runtimeexception: java.lang.runtimeexception: stub! @ org.robolectric.robolectrictestrunner$2.evaluate(robolectrictestrunner.java:240) @ org.junit.runners.parentrunner.runleaf(parentrunner.java:271) @ org.juni

Git says "new commits" but none can be found in the folder -

Image
strange thing couldn't find answer for. don't know how happens past couple of weeks. i keep seeing folder has " (new commits) " @ end when git status i'm sure i've done no changes it. also, when cd folder , git status there, git tells me there no changes present. when commit folder, i'm ok day or two, comes back. comes after git pull , it's shared project , didn't check behaviour yet. any ideas? this indicates mockery directory submodule, have created new commits in directory, , have not updated repository containing submodule point latest commit in submodule's repository. note submodules point specific commits in repository, not remote repository url. ensures when clone repository containing submodules, exact same code author using (or author declared using -- can see here, it's possible not tell "parent" repository new commits). git add mockery instruct git use current head commit in submodule sub

extjs - Changing the store of treepanel after an event -

im quite stuck on changing store of extjs treepanel, after specific event retrieved values server : "{"listtype":false,"text":"root","children":[{"listtype":false,"text":"window","children":[{"listtype":false,"text":"window","children":[{"listtype":false,"text":"height","children":[],"leaf":true},{"listtype":false,"text":"items","children":[{"listtype":false,"text":"border","children":[],"leaf":true},{"listtype":false,"text":"store","children":[],"leaf":true},{"listtype":true,"text":"columns","children":[],"leaf":false},{"listtype":false,"text":"xtype","children":[],"leaf&quo

javascript - AngularJS $http.get returns undefined and $http() is not a function -

i'm building app dynamically load , display data database in angularjs, when try access api (using either $http() or $http.get()), receive errrors. $http.get() error: typeerror: undefined not function , $http() error: typeerror: object not function this specific error occurs in code dynamically load navigation tabs. the code both in coffeescript: p4pcontrollers.controller 'navctrl', [ '$routeparams' '$scope' '$http' ($http,$scope,$routeparams) -> $http( method:'get' url:'http://p4p-api.snyx.nl/tables' ).success (data) -> $scope.tabs = data return return $http.get('http://p4p-api.snyx.nl/tables').success (data) -> $scope.tabs = data return return ] does see i'm doing wrong here? when using array notation injecting dependencies, order of arguments important: in code: ['$routeparams', '$scope&#

data structures - BigInt and indirection: is it feasible to implement BigInt with pointer-arithmetic on the pointer, for small values? -

i assume implementation in language allows treat pointers integers, including doing standard arithmetic on them. if unrealistic due hardware constraints, please let me know. if programming languages don't have such powerful pointer arithmetic, feasible in practice, still want know if approach implementing bigint feasible. i don't have experience low-level - in, programming pointers - programming, many of assumptions in following might wrong. question: far know, implementing bigint - arbitrary precision/size integer - might done dynamic array of integers, grows needed. data structure might represented pointer array of integers. but, assuming pointer integer ones in array, , 1 can pointer arithmetic on pointer, feasible represent value of bigint using pointer? 1 can avoid indirection small values of integers. since pointer either real pointer memory address array of integers, have have way of knowing should treat pointer or integer value. since role through life cycl

ruby on rails - How can I do a "post :create" in RSpec when my route is nested? -

1) how can use "post :create" when route nested. for example... works great rspec controller post :create top level resource, such post "should success response on post create" post :create, params response.should be_success end however, nested resource 'comment' nested under post... above throw following... failure/error: post :create, params actioncontroller::urlgenerationerror: no route matches and if tried "should success response on post create" post :create, post_id: @post.id, params #@post defined , created above response.should be_success end i odd error... syntax error, unexpected '\n', expecting => (syntaxerror) 2) also, right code below testing successful response. however, since i've gone , created post via factorygirl... how can test @post.id equals 1 of id's being returned get: index json? describe api::v1

Error while installing GETOPT::LONG perl module -

i trying install getopt::long . however, getting below error. there way manually remove files , can find files need removed. c:\users\sastagi\desktop\getopt-long-2.42>perl makefile.pl set gcc environment - 3.4.5 (mingw-vista special r3) found left-over files previous version of getopt::long. these should removed. can add instructions makefile remove them when install version. shall add remove instructions? y generating dmake-style makefile writing makefile getopt::long writing mymeta.yml , mymeta.json

Simple neon optimization in Android -

in android application, use bunch of open source libraries such libyuv, libvpx, libcrypto, libssl, etc. of them come android.mk. others, hand-crafted android.mk. the code built arm now. here application.mk: app_abi := armeabi-v7a app_optim := release app_stl := gnustl_static app_cppflags := -frtti i looking way generate binaries optimized neon. browsing net, found following setting using in android.mk: local_cflags += -mfloat-abi=softfp -mfpu=neon -march=armv7 i wonder if put setting in application.mk, automatically applied across libraries? a step before each library built following: include $(clear_vars) is better include local_cflags directive after line (instead of including in application.mk)? finally, why doesn't ndk-build automatically optimize neon when sees armabi in application.mk? regards. it doesn't automatically optimize neon because not arm devices have neon. adding cflags applied if building source. if have .so you're moving

Why does one of these Ruby methods result in 'stack overflow' but the other doesn't? (Permutations Algorithm) -

below 2 different methods listing lexicographic permutations of n objects. can't understand why first method works fine smallish n, fails above limit , results in 'stack overflow'. second method; however, works fine tested limit of 10**6. in advance , insight! $count = 0 $permutations = [] def perms(array) $permutations = array $count += 1 if array.length <= 1 return $permuations end = (array.length - 2) until array[i] < array[i+1] -= 1 end if < 0 return $permutations end j = (array.length - 1) until array[j] > array[i] j -= 1 end array[i], array[j] = array[j], array[i] += 1 j = (array.length - 1) until j < array[i], array[j] = array[j], array[i] += 1 j -= 1 end while $count <= (10**6)-2 perms(array) end end perms([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) print $permutations an

meteor - Handlebars is not defined error with package livestamp-hs -

i using package livestamp-hs in meteor app. works fine, except in console see error message: uncaught referenceerror: handlebars not defined , caused package (helpers.js): if(meteor.isclient) { handlebars.registerhelper('livestamp', function(timestamp) { return new handlebars.safestring('<span class="livestamp" data-livestamp="'+ timestamp +'"></span>'); }); } i checked package.js of package see if handlebars being used, , far know ok: package.on_use(function(api) { api.use(['jquery', 'handlebars'], 'client'); api.add_files(['moment.min.js', 'livestamp.min.js', 'helpers.js'], 'client'); }); although not big problem on localhost, causes infinite loop when deploying either meteor.com or heroku.com. ideas solve this? in meteor 0.8, handlebars package replaced ui package. you'll want use in package.js file ensure pull in. h

c# - How to use AMD Display Library (ADL) Overdrive State Set function (for overclocking programmatically) -

i'm using amd display library allows control parameters of gpu (clock speeds / fan control). the sdk comes sample-managed code , able required result (core , memory clock speeds) adl_overdrive6_stateinfo_get method. using adl_overdrive6_state_set method (which has same parameters) returns error code: int od_result = adl.adl_overdrive6_state_set(osadapterinfodata.adladapterinfo[i].adapterindex, adl.adl_od6_setstate_performance, stateinfobuffer); -8 adl_err_not_supported (function not supported driver.) i've tested on system amd radeon r9 280x / amd radeon hd 7970 , laptop amd radeon 8670m. do need change in driver settings , there compatibility issue? as @novaterata stated in comment try using 7.0 library moved on use afterburner api http://forums.guru3d.com/showthread.php?t=339656 contacting amd didn't help.

Replacing strings in files with bash sed or a scripting language (TCL, perl) -

i have list of c++ source files, have following structure: // lot of stuff #include <current/parser/support/base.hpp> // ... #include <current/parser/iterators/begin.hpp> // ... i need replace lines #include <current/parser/support/base.hpp> with #include <support_base.hpp> namely, omit current/parser , replace separator ( / ) _ . possible bash sed or scripting language? edit: sorry, forgot mention want replace #include <current/parser/*/*/*/*> anything can go after current/parser , , depth. going tcl: # open file reading set fin [open filein.c r] # open file write output set fout [open fileout.c w] # loop through each line while {[gets $fin line] != -1} { # check lines beginning "^#include <current/parser/" # # ^ matches beginning of line # ([^>]*) matches part after "#include <current/parser/" , stores # in variable 'match' if {[regexp {^#include <curr

c# - Set scrollviewer control upon ellipse -

i need set scrollviewer on ellipse. code : <ellipse horizontalalignment="left" height="301" stroke="black" verticalalignment="top" width="300"> <ellipse.fill> <imagebrush stretch="uniform" imagesource="http://cfile3.uf.tistory.com/image/26616e4d514a3cdc136c4b"/> </ellipse.fill> </ellipse> i want this: <scrollviewewr> <ellipse horizontalalignment="left" height="301" stroke="black" verticalalignment="top" width="300"> <ellipse.fill> <imagebrush stretch="uniform" imagesource="http://cfile3.uf.tistory.com/image/26616e4d514a3cdc136c4b"/> </ellipse.fill> </ellipse></scrollviewr> but doesn't work. when zoom elliptical image, becomes rectangle.i need zoom ellipse shape.can know how this?

sql - SP Quotation Error -

can me following line of code. keep getting incorrect syntax near '\' error: set @filename = ''bulk insert dbo.tmp_table ''\\sql-300\convertedfiles\london\figures\' + @year + '_' + @client+ '_' + @policyid + '.csv'' (fieldterminator = '','', rowterminator = ''\n'', keepnulls)'' try this set @filename ='bulk insert dbo.tmp_table ''\\sql-300\convertedfiles\london\figures\' + @year + '_' + @client+ '_' + @policyid + '.csv'' (fieldterminator = '','', rowterminator = ''\n'', keepnulls)'

javascript - innerHTML - td element -

Image
i trying add rows dynamically using dojo code working fine in ie 9 document mode, throwing error in ie8. can rectify this? this sample code. var tr1 = dojo.create("tr",{name:'esigntr',id:'esigntr_'+rowno_form}); tr1.setattribute('class','altrow'); dojo.place(tr1,tbody); var td1 = dojo.create("td",{width:'5%', style:{'text-align':'left', 'verticalalign':'middle'}, align:'center'}, tr1); td1.innerhtml = "<strong>page #:</strong> "; exception in line td1.innerhtml script601: unknown runtime error test.js, line 883 character 2 screenshots attached both verrsion ie 9 as can see, new row has been added after checking radio button - page# ie 8 the row not coming in ie8 getting error script601: unknown runtime error test.js, line 883 character 2 <strong> html 5 element. 99% ie8 not support <strong> element. see here

ios - Orientation is not changed when view is changed from portrait to landscape -

i have menu portrait , detail view (with uiwebview ) can portrait or landscape. when enter detail view , rotate device landscape , go screen in way menu should portrait menu in landscape orientation (along status bar , navigation bar). is there way avoid , force screen rotated desired (supported) orientation? proposed solution @kkumpavat didn't worked me or wasn't clear enough me understand it. did more searching , found solution uses: // http://stackoverflow.com/questions/181780/is-there-a-documented-way-to-set-the-iphone-orientation // http://openradar.appspot.com/radar?id=697 [[uidevice currentdevice] performselector:nsselectorfromstring(@"setorientation:") withobject:uiinterfaceorientationportrait]; but generating annoying warnings , i've swapped with: //force update of screen orientation if (self.interfaceorientation != [self preferredinterfaceorientationforpresentation]) { [[uidevice c

Testing Hoodie.js app on mobile: What URL to use? -

previously testing app on mobile using ip followed whichever localhost on. instance, if on localhost:3000, plug 172.20.10.2:3000 mobile safari url bar view app on mobile. now i've installed hoodie.js, , i'm starting server "hoodie start" in command line, i've been unable test on mobile using same method. this see in terminal when server starts: couchdb started: 127.0.0.1:6003 waiting couchdb [---*--] success run static hook: server.pack.pre www: 127.0.0.1:6001 admin: 127.0.0.1:6002 i've tried above urls , these urls: 172.20.10.2:6003 172.20.10.2:6001 172.20.10.2:6002 and each time mobile safari says server cannot found. can advise? the reason hoodie not accessible outside computer hoodie binds private 127.0.0.1 address. can overwrite setting hoodie_bind_address environment variable. on mac, it's simple hoodie_bind_address=0.0.0.0 hoodie start , i'm not sure how syntax on windows

Print/echo image after retrieving it using curl like this: -

i'm testing code , seems work, doesn't show image code of image. i'm trying changing headers params no luck, idea? really basic fault :) you must put header('content-type: image/jpeg'); @ top of file.

eclipse - Java/Android: passing Intent extras from BroadcastReceiver to Activity -

update: neither eclipse nor code did cause these trouble. genymotion did. maybe approach wrong, since no 1 else seems have problem - if so, open try different ways rather fix problem: have following setting. a broadcastreceiver listening installations of apps. whenever new app installed, create notification, using pendingintent based on normal intent via pendingintent pintent = pendingintent.getactivity(context, 0, notificationintent, 0); before pendingintent created, put extras in normal intent, shall passed activity triggered, when notification clicked. notificationintent.putextra("applabel", applabel); // installed app notificationintent.putstringarraylistextra("group", group); // corresponding group notificationintent.putstringarraylistextra("list", list); // corresponding list now works fine , notification displayed. debugging can see, when pintent created, extras set correctly , passed. however, when try read extras in opened activi