Posts

Showing posts from February, 2012

api - Foursquare Venue - How to get list of people who checked-in and also how to Reply to checkins -

is there api end point returns list of check-ins specific venue in foursqaure. below endpoints not venue specific: https://developer.foursquare.com/docs/users/checkins https://developer.foursquare.com/docs/checkins/reply am missing something?? thanks, d you can find out how many people @ foursquare venue using herenow endpoint: https://developer.foursquare.com/docs/venues/herenow if you're logged in, can discover of friends , friends-of-friends checked venue. foursquare don't expose complete list of user checkin-ins per venue, presumably privacy reasons.

checkbox - Ruby on Rails, submit_tag with 3 checkboxes -

i need like this in ruby on rails. have code selectes specific files either deleted or analyzed: <% if @files%> <%= form_tag what_to_do_files_path, method: :get %> <%= submit_tag "delete selected", :name => 'delete' %> <%= submit_tag "analyse", :name => 'analyse' %> <% @files.each |file| %> <% if (arraydb.file=="no") %> <p><td> <%= check_box_tag "files[]", file.id %></td><%= file.name %></p> <% else %> <div class="my_profile_info"> <p><td> <%= check_box_tag "files[]", file.id %></td> <%= file.name %></p> <td class="info"> <a href="<%=file.info%>" target ="_blank" class= "btn btn-mini btn-info">info</a> </td> </div> <%

css - Bootstrap and visited links -

we using bootstrap provide responsiveness our sites. ux practice indicate followed links, bootstrap built applications, doesn't support this. there workarounds people have used? issue logged , closed bootstrap on year ago (see github ) , indeed workaround recommended use a:visited

asp.net mvc 4 - Open RDLC Report in a pop up window in MVC -

i want know how open rdlc report in new pop up(not on new tab seperate pop-up window). have taken asp.net web application. have added .rdlc , created dataset , report data datasaet. i have report view model getting data render report. have view report button. when click on viewreport @html.actionlink(), report should open popup. i had followed link: rdlc report in mvc web application please suggest me on how approach , provide links. thanks in advance. that depends 1 libs using, generate popups. if aren't using js lib , it's ok open new window on browser, use target="_blank". cause link open in new window, "href"/route need return full html page report. if want more fancy, please tell libs using, me you.

html - how to put a div above a hover while it does not get removed -

i trying put div above div has been hovered. when on new div mouse, hovered image disappeares.. anyone know how fix this? hover in tie way :) my website this: my website the code of hover this: .vierkant img{ position:absolute; width:116px; height:254px; top:0px; margin:0 auto; margin-left:-58px; opacity:0.91; z-index:3; -webkit-transition-duration: 1.2s; -moz-transition-duration: 1.2s; -o-transition-duration: 1.2s; transition-duration: 1.2s;} .vierkant img:hover{ position:absolute; width:80%; height:95%; top:2%; left:auto; right:auto; margin-left:-40%; visibility:visible; z-index:4; opacity:1;} and html code this: <div class="vierkant" align="center"> <img src="img/knoppen/vierkant.jpg" width="90" height="93" /> </div> i know answer has been accepted, really? using jquery or javascript such simple task way overkill when can done , is done css. first off, align=""

c# - How to Serialize in EF5 with ICollection<T> -

i'm using .net 4.5 , entity framework 5.0. have 3 basic entity classes created using code-first approach. i'm trying serialize , unable. here's basics of classes: base class public class baseentity { [key] public int id {get; set;} public datetime startdate { get; set; } public datetime enddate { get; set; } } derived classes public class childentity : baseentity { public int parentid { get; set; } [foreignkey("parentid")] public parententity parententity { get; set; } public string description { get; set; } } public class parententity : baseentity { public virtual icollection<childentity> rules { get; set; } public rulegroup() { this.rules = new hashset<childentity>(); } } my context class public class mydbcontext : dbcontext { public dbset<parententity> parents { get; set; } public dbset<childentity> childs { get; set; } public mydbcontext() : bas

javascript - Improve performance in CKEditor integration with google web fonts -

how can add(programatically) google fonts ckeditor can improve performance here. have around 400 web fonts e.g. google fonts , concat css contents.css take bit long. how can improve it? can add based on font user select , dynamically add css head?

jQuery validation wont fire for dropdown/select lists -

yes might duplicate of million other questions it, me still doesnt work. according jquery validation documentation, having first default item empty value (value=""), , class "required" enough. refuses work correctly. have set correctly, , works fine on checkboxes, radiobuttons, text inputs no problem @ all, select lists? nope. here simple example: <select class="required" id="daydropdown" data-bind="'value': studentbasedata.day"> <option value="">dag</option> </select> <select class="required" id="monthdropdown" data-bind="'value': studentbasedata.month"> <option value="">måned</option> </select> <select class="required" id="yeardropdown" data-bind="'value': studentbasedata.year"> <option value="">År</option> </select> three dropdow

c# - Caching in Asp.net (slidingExpiration and absoluteExpiration) -

hy, how can use absoluteexpiration , slidingexpiration , if specify both of them :absoluteexpiration must datetime.maxvalue or slidingexpiration must timespan.zero. cache.insert("cachetest", value, nothing, ??,??; thanks, for sliding expiration, use this: cache.insert(key, value, nothing, cache.noabsoluteexpiration, timespan.fromseconds(10)) for absolute expiration, use this: cache.insert(key, value, nothing, datetime.now.addminutes(2), cache.noslidingexpiration)

c# - How to check whether generic objects are equal that works for strings -

i ran wierd behaviour today whilst refactoring code. i had code looked this: private atype blah { { return (from in alist _x == null || something.x == _x _y == null || something.y == _y _z == null || something.z.issameas(_z) select something).single(); } } i've anonomised type , variable names aren't important question. the type of _x , something.x string , _y , something.y reference type. likewise _z , something.z reference type value comparison. i thought this: public atype blah { { return alist.single(something => detailsmatch(something.x, something.y, something.z)); } } private bool detailsmatch(string x, anothertype y, afurthertype z) { return nullorcheck(_x, x) && nullorcheck(_y, y) && nullorcheck(_z, z.issameas); } private bool nullorc

asp.net - MVC serverside validation of single posted object -

i'm using single action handle 2 views use separate viewmodel so: [httppost] public actionresult(privatecustomer p, corporatecustomer c) { if(modelstate.isvalid) { ... } } my viewmodels this: public abstract class customer { public string name {get; set;} public string username {get; set;} ... } public class privatecustomer: customer { ... } public class corporatecustomer: customer { [required] public new string name {get; set;} } this means as can use 1 url/action both (closely related) viewmodels. problem is, though, accept both viewmodels parameters post action, , model validation occur both (even though i'll use one). given post privatecustomer, doesn't require name, i'll still validation errors on property. i wondering if there's elegant way somehow prevent happening, preferably without manually removing errors modelstate. the best thing if either of 2 objects validated. thanks in advance suggestions. this difficult in

java - Get default Microphone for settings -

i not able detect default microphone volume settings on windows without using jni . tried several ways not work expected public static float getvolume() { float volume = 0; try { if (audiosystem.islinesupported(port.info.microphone)) { port lineinx = (port) audiosystem.getline(port.info.microphone); lineinx.open(); floatcontrol fx = null; control[] vx = lineinx.getcontrols(); fx = getvolumecontrol(vx, 0); volume = fx.getvalue(); lineinx.close(); } } catch (exception ex) { } return volume; }

ios - AVCaptureSession with multiple previews -

i have avcapturesession running avcapturevideopreviewlayer. i can see video know it's working. however, i'd have collection view , in each cell add preview layer each cell shows preview of video. if try pass preview layer cell , add sublayer removes layer other cells ever displays in 1 cell @ time. is there (better) way of doing this? i ran same problem of needing multiple live views displayed @ same time. answer of using uiimage above slow needed. here 2 solutions found: 1. careplicatorlayer the first option use careplicatorlayer duplicate layer automatically. docs say, automatically create "...a specified number of copies of sublayers (the source layer), each copy potentially having geometric, temporal , color transformations applied it." this super useful if there isn't lot of interaction live previews besides simple geometric or color transformations (think photo booth). have seen careplicatorlayer used way create 'reflection

osx - When change $IFS in bash on Mac OS X -

i met problem when change value of $ifs in bash on mac os x. example, have main directory /xxx/xxx/xxx , , 2 sub-directories subdir1 , subdir2 . if run shell script maindir=/xxx/xxx/xxx; subdirs=$(find $maindir -type d -maxdepth 1); echo $subdirs normally results this /xxx/xxx/xxx/subdir1 /xxx/xxx/xxx/subdir2 these 2 subdirectories separated blankspace . problem is, when change once $ifs value this: oldifs=$ifs; ifs=$'\n'; ifs=oldifs; after that, if check again value of $subdirs echo $subdirs the results become /xxx/xxx/xxx/subdir1 /xxx/xxx/xxx/subdir2 it seems bash automatically changes blankspace \n . bothers me. there solution change \n blankspace ? system mac os x version 10.7.5. you didn't reset ifs (or set oldifs in first place): oldifs="$ifs" ifs=$'\n' ... ifs="$oldifs" (this fails restore ifs unset state if unset prior saving "value", that's not worth going here.)

F# break from while loop -

there way c/c# ? for example (c# style) for( int i=0; i<100; i++) { if(i==66) break; } the short answer no. use higher-order function express same functionality. there number of functions let this, corresponding different patterns (so if describe need, might give better answer). for example, tryfind function returns first value sequence given predicate returns true , lets write this: seq { 0 .. 100 } |> seq.tryfind (fun -> printfn "%d" i=66) in practice, best way go if expressing high-level logic , there corresponding function. if need express break , can use recursive function: let rec loop n = if n < 66 printfn "%d" n loop (n + 1) loop 0 a more exotic option (that not efficient, may nice dsls) can define computation expression lets write break , continue . here example , said, not efficient.

c# - How to properly run “top” command through SSH? -

i'm using library connect linux commands run , run commands have problems for example, have problem running these commands: top , top -n 1 error:term environment variable not set private void button2_click(object sender, eventargs e) { renci.sshnet.sshclient sshclient = new renci.sshnet.sshclient("192.168.150.128", "reza", "1"); sshclient.connect(); var command = sshclient.runcommand("top"); var line = command.result.split('\n'); list<serverstatuscpu> serverstatus = new list<serverstatuscpu>(); (int = 3; < line.length - 1; i++) { var li = line[i]; var words = li.split(' '); list<string> fillterwords = new list<string>(); foreach (var w in words) { if (w != "") { fillterwords.add(w); }

excel - How to use an If macro to delete columns if check box for that column isn't selected? -

i working spreadsheet 11 different system sizes on each system size representing column. need use able compare different system sizes need able select system sizes want @ times. example, system sizes 1300, 2000, 2000x, 2500, 2500x, 3000, 3000x, 4500, 6000, 7000, , 9000 , might need compare 2500, 3000, , 4500. have put check box in row 3 in each of these columns represent each system size , linked check box same cell in system 1300 check box in cell b3 , linked cell b3. want able go in , select each check box each system size want able run macro keep columns/system sizes check boxes selected , delete or hide columns/system sizes check boxes not selected. below code have system 1300. dim system1300 string system1300 = range("b3").value if not system1300 "true" activesheet.shapes.range(array("check box 1")).select selection.delete columns("b:b").select range("b2").activate selection.delete shift:=xltoleft end if however, reason, wh

html - WHy is it that in bootstrap when I minimize my window my <p> keeps getting longer and pushes all the content below it down -

ok have basic bootstrap layout <div classs="row-fluid"> <div class="span12" style="background:black; padding:25px 0px;">content content</div> </div> <div class="span4 offset2"> <p>blah blah blah test blah blah blah testblah blah blah test <br /> blah blah blah testblah blah blah testblah blah blah test</p> </div> <div class="span12" style="blue; padding:25px 0px;">content content</div> as minimize window <p> shrink in width extend paragraph down gets thinner , longer window minimizes pushes content span12 @ bottom down. want <p> not longer window minimizes maybe smaller or something. tried removing margin , padding when keep content in bottom of <p> being pushed down <p> literally still extends under bottom span12 , creates margin way @ bottom of page. can tell me whats going on please. update: here fiddle

Connecting to database(MS Access) in asp.net c#(hosting website) -

i have hosted website, , need add database password , log-in information. (ms access db), tried lot can't connect (on local machine works). tried change connection string still doesn't work. database in folder app_data. here's type in login.aspx page: oledbconnection con = new oledbconnection(); con.connectionstring = @"provider=microsoft.ace.oledb.12.0;data source=" + server.mappath("~\\app_data\\websitedatabase.accdb"); con.open(); this not work. need change? i've put web site on somee.com did check page on somee connecting access database? quote somee.com help: connect ms access database usin dsn-less connection doka provides dsn-less connection access databases, because faster , there no possible names conflict. of problems in choosing right connection string. here example of tested connection string ms access database: suppose database resides in “database” subfolder , name “testdb.mdb” .

PHP getdate not returning the correct time? -

this question has answer here: getdate() returns wrong time 3 answers i have timezone set africa/johannesburg (+2gmt) in php.ini. getdate says hour 0. hour 3 , if somehow still stayed in utc, 11 am. changed pc time , it's still not working. else cause this? use date_default_timezone_set for example: date_default_timezone_set('africa/johannesburg');

arrays - Checking two strings for approximate match in PHP -

i'm trying check approximately similarity of strings. here criteria use that. 1) order of words important 2) words can have 80% of similarity. example: $string1 = "how cost me" //string in vocabulary (all "right" words here) $string2 = "how costs " //"costs" instead "cost" -is deliberate mistake (user input); algoritm: 1) check similarity of words , create clean string "right" words (according order appear in vocabulary). output: "how cost " 2) create clean string "right" words in order appear in user input. output: "how cost it" 3)compare 2 outputs - if not same - return no, else if same return yes. any suggestions? i started write code, i'm not familiar tools in php, don't know how rationally , efficiently. it looks more javascript/php $string1="how cost me" ; $string2= "how costs it"; function comparestrings($string1, $string2) { if

javascript - Dropdown navigation not working in IE10 browser but in rest its working fine -

example : dropdown menu working fine in browser in ie10 submenus not visible while hovering on main menu. strange. below js used in example : http://www.steelecapital.com/pages/js/ibmenu.js dont know issue strange.

osx - Create a new file based on matching between two files -

i having 2 files first file in format. each line starts unique id (in case p22465) p22465 db db; ec.31.1.1; annexin (annexin) group. second file in format.each line starts (some number)@entrezgene 309@entrezgene|anxa6_human@swissprot|p08133@swissprot|anxa6:anxa6|67 kda calelectrin 30@entrezgene|thik_human@swissprot|p22465@swissprot|acaa1:acaa1|ec 2.3.1.16 output should 30@entrezgene|thik_human@swissprot|p22465@swissprot|acaa1:acaa1|ec 2.3.1.16 it should match line containing unique id (p22465) in second file , copy whole line new file using bash : fgrep -f <(awk '{print $1}' file1) file2 this uses process substitution ( <(...) ). with: awk '{print $1}' file1 | fgrep -f - file2 this tells fgrep 'read strings matched standard input' ( -f - ). i've not verified works, i'd expect so. you can use grep -f in lieu of fgrep (but mac os x has fgrep ).

mobile - Can't compile app built with earlier version of android on newer version of Android -

i have existing android app built using android 11. however, newest version of adt allows me compile android 17 app not run. how newest version of adt run existing app? i error when attempt run app. "unable resolve target 'android-11'" either: download api level 11 sdk sdk manager, or update project use build target have (e.g., project > properties > android in eclipse) along avd remaining on android boot screen. either: have patience , wait avd boot complete, or buy faster computer, or switch the x86 emulator

sql - Cleaning text strings in vb -

i trying clean string text field part of sql query. i have created function: private function cleanstringtopropercase(dirtystring string) string dim cleanedstring string = dirtystring 'removes non alphanumeric characters except @, - , .' cleanedstring = regex.replace(cleanedstring, "[^\w\.@-]", "") 'trims unecessary spaces off left , right' cleanedstring = trim(cleanedstring) 'replaces double spaces single spaces' cleanedstring = regex.replace(cleanedstring, " ", " ") 'converts text upper case first letter in each word' cleanedstring = strconv(cleanedstring, vbstrconv.propercase) 'return nicely cleaned string' return cleanedstring end function but when try clean text 2 words, strips white space out. "daz's bike" becomes "dazsbike". assuming need modify following line: cleanedstring = regex.replace(cleanedstring, "[

PdfStamper in Java Applet -

i use pdfstamper in java applet sign pdf files. problem applet every time suspends when reach line pdfstamper.close(); think problem related java applet policy have granted permissions like: grant { permission java.security.allpermission; }; my code is: import com.lowagie.text.documentexception; import com.lowagie.text.rectangle; import com.lowagie.text.pdf.pdfreader; import com.lowagie.text.pdf.pdfsignatureappearance; import com.lowagie.text.pdf.pdfstamper; import java.io.bufferedreader; import java.io.bytearrayoutputstream; import java.io.file; import java.io.fileinputstream; import java.io.filenotfoundexception; import java.io.fileoutputstream; import java.io.ioexception; import java.io.inputstream; import java.io.inputstreamreader; import java.io.outputstream; import java.security.accesscontroller; import java.security.keystore; import java.security.keystoreexception; import java.security.nosuchalgorithmexception; import java.security.privatekey; import java.security.pr

SCons code generation and VariantDir -

i scons generate source files me in src/ directory, , build them other source file in build directory build/variantx . this scons file: import scons def my_builder(env, target, source): # stuff pass env = environment() env.variantdir('build/variant1/', 'src', duplicate=0) env.command('src/foobar.cc', 'src/foobar.input', action=my_builder) env.program('bin/test', [ 'build/variant1/foobar.cc', 'build/variant1/test.cc', ]) this errors following message: source src/foobar.cc not found, needed target build/variant1/foobar.o which don't think correct, considering indeed providing command build src/foobar.cc . now, tried few workarounds: if replace build/variant1/foobar.cc in program src/foobar.cc , work, foobar.o gets created in src/ rather build/variant1 if replace src/foobar.cc in command build/variant1/foobar.cc , work, code generated in src/ ; (also because things relative path

iphone - IOS ScrollView Issues -

hey i'm following tutorial , on first step experiencing weird behavior. tutorial on creating scroll views images , ends showing how create paged horizontal scrollview page controller. followed first section , things seemed working fine. when ran code did not perform properly, after hour of debugging downloaded final project, ran on phone check if working correctly (it was) copied code required files in project. project still wouldn't run. figured must way in story board configured on project setup. oped working example cleared storyboard , created views , segues self, in exact same way , order had done in project. bam! still worked, when deleted views in story board , recreated them in exact same fashion, still nothing. tutorial , tell me if i'm going crazy or experience similar results. have narrowed down 2 possibilities, project provided @ end of tutorial created differently , delegates or outlets hooked in way works project, or project created earlier versio

sql - Oracle combine two rows into one -

i have result this: 15.04.13 5 doe, john 2431 null null 46 560 0 null 0 15.04.13 5 doe, john 2431 paid 525 0 0 585 null 60 this result of union of 2 queries. what need 1 row per day , person. what i'm looking way combine these 2 rows like 15.04.13 5 doe, john 2431 paid 525 46 560 585 null 60 ok lets result that: 15.04.13 5 doe, john 2431 null null 46 560 null null 0 15.04.13 5 doe, john 2431 not paid 323 0 0 452 null 55 15.04.13 5 doe, john 2431 paid 525 0 0 585 null 60 i need second , third row , match 46 , 560 first row rows below. in case group max() won't work. how can solve ? this sounds job group by select some_date , some_id , some_name , some_number , max(paid) paid , max(amount) amount , max(etc) etc some_table group some_date , some_id , some_name , some_number

Calling function with two different types of arguments in python -

i new python. came across weird case , not able figure out issue is. have 2 versions of function written in python :- v1 - def filelookup(fixedpath, version): if version: targetfile="c:\\null\\patchedfile.txt" else: targetfile="c:\\null\\vulfile.txt" #some more code follows and v2 - def filelookup(fixedpath, version): if version: print "ok" else: print "not ok" #some more code follows where parameter fixedpath string entered , parameter version supposed integer value. 1st function (v1) not work expected, while tje second works perfectly. both times function called filelookup("c:\\dir\\dir\\", 1) . in 1st case error received :- filelookup("d:\\celine\\assetserv\\", 1) exception: filelookup() takes 2 arguments (1 given) please let me know why 1st function throwing exception? here actual code.... from system.io import *; def filelookup(fixedpath, version):

jquery - JQPlot replot with meter -

i need getting replot method work. i have simple script , doesn't update needle. i've 'dumbed' down hard coded change onload of '1' update of '3'. update doesn't change meter. $(function(){ var usageplot = $.jqplot('usagemeter',[[1]],{ options dont matter} }); function networkrefresh() { usageplot.data=[[3]]; usageplot.replot(); } var gn = setinterval(networkrefresh,2000); } and <div id="usagemeter"></div> markup it renders 1 value corectly, networkrefresh updates 2 seconds later. don't redraw. remains @ 1. what missing? i able find user similar issue , answer: reuse jqplot object load or replot data need shove series value in like: usageplot.replot({data:[[3]]}); in replot call instead of in data call itself.

php - $_POST and $_GET convert quote( ' ) to backslash + quote ( \' ) -

i have code : <?php echo $_get['user']; ?> <html > <head> </head> <body> <form method = "get" action="file.php"> <input type = "text" name = "user"><br> <input type = "submit" value ="submit"><br> </form> </body> </html> when type ' in textbox prints out \' instead of ' . example if type 'hello' prints out \'hello\' . how can fix ?? the slashes added because have magic_quotes_gpc=on in php.ini . note feature depreacted , should turn off in php.ini . former security feature should not rely on it. instead write code valides all inputs , use prepared statements when pass inputs sql queries or use escapeshellarg() if pass inputs shell scripts. however, use stripslashes() remove slashes: echo stripslashes($_get['user']);

sql - How to populate a single-dimension array with result of a query FOR DB2? -

i need populate single-dimension array result set select query. i have created array type using: create or replace type ur.array_traveler_id bigint array[]; and in stored proc using following select query: select traveler_id bulk collect arraylist ur.appliedprofile travelerprofileid = p_travelerid; i have declared arraylist as: declare arraylist ur.array_traveler_id; i dont know problem db2 not allowing me use bulk collection. the error getting "an unexpected token "collect" found following.....sqlstate=42601" please suggest way around. the bulk collect clause valid in pl/sql context. should running db2 9.7 fix pack 1 or later, database must created in oracle compatibility mode, , procedure must written in pl/sql, not db2 sql pl.

javascript - How do I disable input field when certain select list value is picked -

how disable , make input field text hidden when value selected select list? in code, need disable , make input text hidden when "united states" selected drop down. my html: jsfiddle link my javascript: document.getelementbyid('billingcountrycode').onchange = function () { if(this.value != '840') { document.getelementbyid("billingstateprovince").disabled = true; document.getelementbyid("billingstateprovince").style.display="none" } else { document.getelementbyid("billingstateprovince").disabled = false; document.getelementbyid("billingstateprovince").style.display="block" } } the problem fiddle have 2 elements same id. can there, change id on either state dropdown or text input. updated code might this, if name text input same 2: document.getelementbyid('billingcountrycode').onchange = function () { if(this.value != '8

Avoid sidebar overlapping content on tumblr with CSS positioning -

i'm having problems avoiding sidebar overlap main content of blog on tumblr. using premade template on tumblr have modified. ways can position sidebar in top right corner, using absolute or fixed position: #sidebar{ position:fixed; top:20px; right:20px; } when using e.g. relative, sidebar position in bottom after main content. my page built this: <body> <div id="page"> <div id="header"> </div> <div id="content"> </div> </div> <div id="sidebar"> </div> </body> click here see page. tried putting sidebar inside page div, there's constraint on width, keep. thank in advance. according latest comment, should problem: you set min-width on page, rearrange markup little, , remove styles on sidebar. if leave now, following help: set min-width: 1250px; on body tag move sidebar element before page element

c# - How to propagate an exception across SOAP Web Services? -

i have standard asmx web service. want throw custom exception , have caught on client side. thing ever comes across soapexception. example: // server side code [webmethod] public void foo(string bar) { throw new customexception(bar); } public class customexception : exception { .... } // client side code public void callfoo() { try { service.foo() } catch (customexception ex) { console.writeline(ex.message); } catch (soapexception ex) { console.writeline("it hits here"); } catch (exception ex) { console.writeline(ex.message); } } is there way send through customexception exception? serialize somehow perhaps? according msdn: '[...] exceptions thrown xml web service method thrown soapexception[...]', handling , throwing exceptions in xml web services . that said, nothing prevents creating exception wrapper class , serialize it, @davogones suggested on post: how serialize

ruby on rails - Cannot push to github, ssh: Could not resolve hostname -

i can't pass this, have remade repository multiple times, made ssh keys over -------------- demo_app <username>$ git remote add origin git@github.com:<username>/demo_app.git fatal: remote origin exists. $ git push -u origin master --- ssh: not resolve hostname git: nodename nor servname provided, or not known --- fatal: not read remote repository. --- please make sure have correct access rights --- , repository exists. ---------- --------- checked ssh keys --- $ ssh -t git@github.com hi <username>! you've authenticated, github not provide shell access. --- still receiving same message. instead of adding new remote, try change existing 1 following command: git remote set-url origin git@github.com:<username>/demo_app.git edit: so, here commands make work without losing code. rm -rf .git git init . git remote add origin git@github.com:<username>/demo_app.git git commit --allow-empty -m 'first commit' git push

Optimizing matlab code by removing nested for loop? -

this code given, takes long run. how make faster removing nested loop? igroup = 1:length(groupindices) curgroupindex = groupindices(igroup); curchanindices = chanindices{igroup}; curchannames = channames{igroup}; grouppropstruct = propstostruct(propnames{curgroupindex},propvalues{curgroupindex},replace_str,prepend_str,always_prepend); groupstruct = struct('name',groupnames(igroup),'props',grouppropstruct); ichan = 1:length(curchanindices) curchanindex = curchanindices(ichan); chanpropstruct = propstostruct(propnames{curchanindex},propvalues{curchanindex},replace_str,prepend_str,always_prepend); chanstruct = struct('name',curchannames{ichan},'props',chanpropstruct,... 'data',[]); chanstruct.data = data{curchanindex}; groupstruct.(tdms_genvarname2(chanstruct.name,

php - What is "Request Headers From Upload Stream" -

Image
from firebug: if want emulate request using php-curl , have worry request headers upload stream? ? when upload file, during http request, there standard http request headers see, like: -------------------------------18788734234 content-disposition: form-data; name="nonfile_field" {input field here} -------------------------------18788734234 content-disposition: form-data; name="myfile"; filename="somefile.gif" content-type: image/gif {uploaded file here} -------------------------------18788734234-- firebug pulling out these request headers come file uploads , giving more information it. if standard file upload php-curl, curl needs ensure upload happens successfully.

Android Facebook SDK with fragment -

i'm trying follow facebook tutorial here https://developers.facebook.com/docs/getting-started/facebook-sdk-for-android/3.0/ i'm getting error onactivityresult ideas? difference between mine , theirs mine fragment instead. package com.projectcaruso.naturalfamilyplaning; import com.facebook.*; import com.facebook.model.*; import com.projectcaruso.naturalfamilyplanning.r; import android.os.bundle; import android.support.v4.app.fragment; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.widget.textview; import android.widget.toast; import android.content.context; import android.content.intent; public class facebooklogin extends fragment{ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); } @override public view oncreateview(layoutinflater inflater, vie

ios - NSJSONSerialization output number as float? -

i'm using nsjsonserialization convert dictionary json. if include nsdecimalnumber ( == 0 ) in dictionary outputs 0 . wrong. 0 int. need output 0.0 . this i'm doing: nsdecimalnumber *decimal = [[nsdecimalnumber alloc] initwithfloat:0.0f]; // when fed nsjsonserialization outputs 0 is there way output 0.0 ? or incorrect in assumption? 0 valid float? there no way affect way nsjsonserialization outputs numbers. should not worry this. json doesn’t distinguish between different types of numbers, should accept numbers , without decimal points, no matter actual type of number doing calculations with.

finance - Non-consecutive number of lags in VAR (R package "vars") -

is possible (in package "vars" or maybe in other r package?) include non-consecutive lags var model, i.e., lags 1 , 3. so far, looks when set p = 3 under function var , includes consecutive lags between 1 , p (i.e., 1:3). you can use restrict vars package estimating restricted var. method requires estimate model twice: 1) unrestricted model "consecutive lags" , 2) restricted model lags want. so, becasue restrict function takes input object of class 'varest'. see alternative: > library(vars) > data(canada) # data > model <- var(canada[,1:2], p=3) # unrestricted var > #bcoef(model) restriction matrix have have same dimension dim(bcoef(model)) # building restriction matrix > restrict <- matrix(c(1,1,0,0,1,1,1, 1,1,0,0,1,1,1), nrow=2, byrow=true) # re-estimating var lags 1 , 3 > restrict(model, method = "man", resmat = restrict) var estimation results: ======================= esti

change drupal 7 views menu title at runtime from code -

all, i can't find way change menu title of drupal views page view programmatically @ runtime. i've looked @ $view object, don't see page settings menu tab title slot. any clues? thanks [edit] i found answer: for curious, turns out hook_menu_local_tasks_alter(&$data, $router_item, $root_path) provides access menu titles @ runtime. dpm($data) show how.

java - I need help on Bit Twiddling -

i love see people writing bit twiddling code can't understand @ all. gone through hacker's delight , http://graphics.stanford.edu/~seander/bithacks.html , failed understand anything. for example: how come 1 | 2 returns 3 or how come a ^=b; b ^= a; ^=b; swap values etc... one method: private t[] ensurecapacity(int mincapacity) { if (tmp.length < mincapacity) { // compute smallest power of 2 > mincapacity newsize |= newsize >> 1; int newsize = mincapacity; newsize |= newsize >> 2; newsize |= newsize >> 4; newsize |= newsize >> 8; newsize |= newsize >> 16; newsize++; if (newsize < 0) // not bloody likely! newsize = mincapacity; else newsize = math.min(newsize, a.length >>> 1); @suppresswarnings({"unchecked", "unnecessarylocalvariable"}) t[] newarray = (t[]) new object[newsize]; tmp = newarray; } return tmp; } what below like

javascript - How can I have a function cause all but the first option in a drop down menu open a new webpage? -

this code have far: `<!doctype html> <html> <head> </head> <body> <img src="http://blog.dubspot.com/files/2011/09/dubspot-dj-producer-banner-2.jpg" alt="electronicmusic" width="1350" height="250"> <h1>electronic music sampler</h1><br> <p>select genre sample</p> <form> <select id="select" onchange="window.open(this.options[this.selectedindex].value,'_parent')"> <option value="genre">select genre</option> <option value="https://www.youtube.com/watch?v=swxjxt1hjrs">ambient</option> <option value="https://www.youtube.com/watch?v=jrftxciqfq8">breakbeat</option> <option value="https://www.youtube.com/watch?v=rgoz_cpem8a">chiptune</option> <option value="https://www.youtube.com/watch?v=6gmgjvac-ws">downtempo</option>