Posts

Showing posts from January, 2015

why is meteor Tracker.autorun() detects mongodb changes with a delay, if the collection was modified outside of the meteor application -

a scenario: in local meteor (v 1.2.1) development environment (webstorm), autopublish, , insecure enabled, have single mongodbdb (v 3.0.4) collection 'letters'. wish respond documents being added, removed, or modified in collection. for purpose, have following autorun function: template.diagram.rendered = function(){ tracker.autorun(function () { letters.find({}).observe({ added: function(document) { console.log('a new document has been added'); }, changed: function(newdocument) { console.log('a document has been changed'); }, removed: function(document) { console.log('a document has been removed'); } }); }) } when new document added within same application, can see console messages right away (meteor latency compensation). however, when connect same mongodb database using external tool (robomongo), , add,...

asp.net - Why I can't get selected file on server side? -

i have asp code: <asp:panel runat="server"> <div class="row2"> <input type="file" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel" id="fileselect" name="fileselect" runat="server" /> <asp:button id="btnupload" runat="server" text="load" onclick="btnupload_click2" causesvalidation="false" /> </div> </asp:panel> here generated html code on browser: <div class="row2"> <input name="ctl00$contentplace$fileselect" type="file" id="ctl00_contentplace_fileselect" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"> <input type="submit" name="ctl00$con...

python - Function breaks all code that come after it -

i've started working on small game. i've created function breaks code follows it. here's full function: def printboard(currentboard): #prints out game board x in range(5): #prints out 50 character line x print (' '.join(str(currentboard[x*50:(x+1)*50])) although still works this: def printboard(currentboard): print (' '.join(str(currentboard[x*50:(x+1)*50])) even things like: print("hello") won't work after it. i've tried switching around variable names , such error error still remains. looks missing closing ")"

How do I import the Spark Knowledge Modules in Oracle Data Integrator 12c? -

i need change default lkm file spark knowledge module in odi 12c. unfortunately, when try import /.../odi/sdk/xml-reference/component_kms/spark_python , nothing appears in list of knowledge modules import. knowledge modules appear (though wrong ones) when @ /.../odi/sdk/xml-reference/ . looking @ structure of spark km xmls, appears different regular kms. does know if there way import these modules make possible copy/change them? components km can not imported / duplicated / modified / deleted. while template-based kms template of code can edit , fine-tune, components kms based on java libraries , act more black boxes. can't create own component km. editor component kms might available in future though. if have change in spark km, guess solution create new template-based km spark.

asp.net mvc - MVC drop down list is not picking up selected item? -

my model contains array of zip code items ( ienumerable<selectlistitem> ). contains array of selected zip codes ( string[] ). in html page, want render each selected zip code drop down zip code options. first attempt did not work: @foreach (var zip in model.zipcodes) { html.dropdownlist( "zipcodes", model.zipcodeoptions ) } i realized although produce drop downs right "name" attribute, wouldn't know element of zipcodes holds value particular box, , might default first one. my second attempt surprised me. explicitly set proper selectlistitem's selected property true, , still rendered control nothing selected: @foreach (var zip in model.zipcodes) { html.dropdownlist( "zipcodes", model.zipcodeoptions.select( x => (x.value == zip) ? new selectlistitem() { value = x.value, text = x.text, selected = true } : x ) ) } there, it's returning new ienumerable<selectlistitem> contains original items, unless it's...

php - How to add sql data to table but not override it? -

i creating webapp people can add data. ex: have first name , last name. want update user's account, not want delete user's old data (old_name, old_lastname, old_email, etc). instead want keep user's old data , create new record. need access them show old names used. from found need add time stamp, can not find example. if show me code add current page me lot. once able add records instead of updating them add lot more fields. here account page : <?php include 'header.php'; session_start(); //kick none users off page if(isset($_session["userid"])) { } else { header('location:login.php'); } //display user info $user = $_session[userid]; $results = $con->query("select * users userid='$user'"); $row = $results->fetch_array(mysqli_both); session_start(); $_session["firstname"] = $row['firstname']; $_session["lastname...

Why Chrome on Linux shows "External protocol request" dialog for unknown protocol? -

Image
i creating custom protocol handler google chrome on linux. link looks this: <a href="myprotocol:someargument">trigger app param</a> i have noticed if 'myprotocol:' not registered (my app not installed), google chrome on linux displays "external protocol request" dialog , tries use xdg-open: while on other os, such windows 10 , os x el capitan nothing displayed if protocol not registered. i have verified firefox works consistently unknown protocols on windows, os x , linux - nothing displayed. chrome behavior on linux quite confusing users. any idea why chrome on linux (i testing on ubuntu 14.04) acts differently other os , web browsers? the issue if chrome lacks local protocol handler wants use handler configured in user's environment. no 2 oses provide same api launch default handler. figuring out program before launching not clear api on windows or linux. both "mac" , windows implementations end knowin...

java - How to find the MAC address of Wi-Fi devices connected to socket -

i developing web application acts server. in application have implimented serversocket 2 way communication between server application , wi-fi device acts client. not connecting server directly, connecting router port forwards system , 2 way communication successful. want find mac address of wi-fi device connected.i have done research , tried mac address failed.can me on this.below part of code. public class schedulejob extends servletapp implements job{ private int port = 1717; public static string number; string receiveddata = ""; public void execute(jobexecutioncontext context)throws jobexecutionexception { system.out.println("starting ... "); serversocket sersocket = null; system.out.println("starting socket server @ port:" +port); boolean listeningsocket = true; try { sersocket = new serversocket(port); system.out.println("waiting clients..."); } catch (ioexception e) { system.err.print...

java xml, create self closing tag -

i'm using xerces xml library in java. i'm able create element like: element myelement = doc.createelement("element"); which result in <element></element> . how create element result in self closing tag so? <element/> thanks.

ruby on rails - What can be done about an unsafe/outdated gem dependency of a required gem? -

i have bundler-audit (a check known vulnerable gems) included pre-commit , in ci. comes known vulnerability in previous version of nokogiri gem , recommends upgrade. but here's rub: vulnerable gem among transitive dependencies of rails , few other gems can't strip out. of them use pessimistic version specifier explicitly precludes version of nokogiri i'd need upgrade. what 1 in situation this? advice? if current rails 4.x gem has dependency, file bug against rails. i'd surprised if current 4.x version of rails has dependency on insecure version of gem, though.

database - Condensing Excel data with overlapping index/repetitive word occurrence -

Image
i have excel sheet formatted so: i format this: it 40,000 cells of information, there way isn't manually? you use =sumif achieve this, since appear have numbers values. create new sheet, copy column data sheet new sheet , remove duplicates. copy row 1 data sheet new sheet. use formula in sheet 2 cell b2: =sumif(sheet1!$a:$a;sheet2!$a2;sheet1!b:b) drag formula right, down.

c++11 - What are all the possible values of a bool value in C++? -

the question not obvious seems, , have trouble finding information bool type in standard. according c++11 standard, guarantees associated bool type regards to: storage: how space take, ignoring alignment? there requirement value stored represent true and false ? values taken: let b of type bool , assertion (b == true) || (b == false) hold? (false < true) well-formed, , hold? bool types described in section §3.9.1, fundamental types. of relevance here sentence paragraph 6: values of type bool either true or false . 47 the reference footnote 47 provides interesting additional information: 47 ) using bool value in ways described international standard “undefined,” such examining value of uninitialized automatic object, might cause behave if neither true nor false . this direct consequence of standard imposing no requirements on programs undefined behaviour. there no size requirements on bool , other implicit "at least 1 byte" ap...

Blending modes in c++ (Direct2D) -

i trying blend 2 images using direct2d latest direct2d supports effects , blending options. avoid using latest version due compatibility issues. with being said, there way recreate blending mode (hard-light) in direct2d without effects class , still keep hardware accelerated. if not, purely software side rendering adversely affect performance? how can access pixels in d2d , pixel pixel manipulations? thank you first, version of directx using? 1- can write own shaders , change rendering pipeline use shaders, may lot of work if you've never done before. this link discusses rendering pipeline in dx11, , this link discusses in dx 9. look @ if you're working in dx9 . 2- purely software manipulation outstandingly slow, unless one-time manipulation. if it's shading or lighting you're trying do, software rendering out of question. heavily depends on number of images , size of each image. mean, if you're doing on tiny 16x16 images per frame, possib...

iphone - iOS Hiding Status bar and tab bar in iOS 6 + 7 -

i've got tabbed application , in 1 tab there uiwebview. when rotate device landscape i'd make uiwebview full screen on status bar , tab bar. //edit ok, i've got working in ios 6 - when rotating , hiding tab bar leave black space tab bar was, fheight code fixes this. on ios 6 worked perfectly, creates black bar problem ios 6 having!! ideas workaround this? - (void)willrotatetointerfaceorientation:(uiinterfaceorientation)tointerfaceorientation duration:(nstimeinterval)duration; { if(tointerfaceorientation == uiinterfaceorientationlandscapeleft || tointerfaceorientation == uiinterfaceorientationlandscaperight) { [self hidetabbar:self.tabbarcontroller]; [[uiapplication sharedapplication] setstatusbarhidden:true withanimation:uistatusbaranimationslide]; } else { [self showtabbar:self.tabbarcontroller]; [[uiapplication sharedapplication] setstatusbarhidden:false withanimation:uistatusbaranimationslide]; } } - (void) h...

stringr - How to replace column in a dynamically-named data frame in R -

i'm working on stuff fantasy football league. populate series of data frames, each named position (e.g., qb quarterbacks, rb running backs, etc.) i've been able use apply() function lot rbinding separate chunks of position single dataframe, i'd strip out text each position. so have dataframe named qb, , 1 of columns called player, has superfluous text i'd remove. so, if this, works: theposnick <- "qb" theplayer <- paste(theposnick, "$player", sep="") g <- str_replace(eval(parse(text=theplayer)), "remove text", "") g <- str_replace(g, "more meaningless text", "") g <- str_trim(g) #expected behavior: qb$player <- g that works fine, however, i'd love able dynamically, , doing following doesn't seem work: theposnick <- "qb" theplayer <- paste(theposnick, "$player", sep="") g <- str_replace(eval(parse(text=theplayer)), "...

php - imagick pseudostring format -

Image
i'm putting image handler in imagick - i've looked @ pseudoimage class: $test->newpseudoimage($width, $height, $pseudostring); however can't find breakdown of pseudostring can contain - know one? and i'm making use of setoption: $text->setoption('fill', $fontcolour[$_post['fontcolour']]); but can't find clear explanation of how maps (i assume) image magick's own variables. i have searched here , google, need clear breakdown - can point me one? thanks pseudo format imagemagick's pseudo format can defined "format:[argument]". each format have it's own unique effects/behavior, , cover range of image properties (e.g. label: "hello world!" ) specific os actions (e.g. **x:***root*). there built-in images can accessed through pseudo format. examples: $img = new imagemagick(); $img->newpseudoimage(75,50,'label:"hello world!"'); $img->writeimage('hello.png'...

c# - WPF DataGridTextColumn binding doesn't accept decimals -

i don't understand problem be. binding on decimal property. here xaml: <datagridtextcolumn header="price" binding="{binding price, mode=twoway, updatesourcetrigger=propertychanged} width="*"/> i literally cannot type '.' character. why stop me typing character , how tell let me so. i tried doing string format this: <datagridtextcolumn header="price" binding="{binding price, mode=twoway, updatesourcetrigger=propertychanged, stringformat={}{0:n2}} width="*"/> but doesn't solve problem because append ".00" end of whatever type. all need permission type period. update: i directed here . removed updatesourcetrigger property , made possible me type '.'. not have 4.5 beta installed , localization settings correct. question how datagridtextcolumn allow me type '.' updatesourcetrigger property set? updatesourcetrigger=propertychanged reevalutes text on every keyst...

Perforce: Move files to a new Depot (including deletes) -

i have 3 different perforce depots (a, b, , c). each of these 3 depots has long revision history , includes many internally moved & deleted files. i want move contents of a, b, , c folders inside new depot d. once that, i'd remove a, b, , c. tried the p4 move command within p4v, can't seem move deleted files a, b, , c new folders in d. is there way (either in p4v, p4admin, or via command line)? basically, move entire depot folder in new depot , maintain complete revision history (including deleted files). thanks! it sounds want change history. want perforce pretend files weren't created in a, b , c, have instead have resided in d. not done. it's possible complicated scripting (or via api) can reproduce of file operations in new location. along lines of python script have can import vss data set.

javascript - Send form inputs with AJAX to PHP -

i want send form inputs page php function, using ajax, , save data in multidimensional array. there should no page reload, , response can simple true or false . in chrome browser, can see both inputs in "request payload" element, in json, how can retrieve data in php , transform data array? html: <div id="formeditbilling"><form> <input name="register[personal][firstname]" type="text" id="firstname" value="" class="text required " placeholder="firstname"> <input name="register[personal][lastname]" type="text" id="lastname" value="" class="text required " placeholder="lastname"> <input type="buttom" id="editbilling" value="speichern"/></form></div> javascript: <script type="text/javascript"> $('#editbilling').click(function() { editbillin...

sql - Getting detail with the highest priority using Joins/subqueries -

i hope can me problem: have 3 tables, similar this: order order_id | order_date ===================== 1 | 01/01/2001 2 | 02/01/2001 3 | 03/01/2001 4 | 04/01/2001 5 | 05/01/2001 order_detail order_detail_id | order_id | status_id ====================================== 1 | 1 | 1 2 | 1 | 1 3 | 1 | 2 4 | 2 | 2 5 | 2 | 3 6 | 3 | 3 7 | 3 | 3 status status_id | status_name | status_priority ========================================= 1 | pending | 3 2 | completed | 2 3 | cancelled | 1 now, suppose shows, each row in order_detail table related order table using order_id, , has status indicated status_id. also, status table has status_priority column. need show each order, along with,...

c# - how correctly to end all process of program -

my program has event onclosing - hide it. need implement closing of programm - try use context menu of task bar notification item. code: private void formmainform_formclosing(object sender, formclosingeventargs e) { //canceling closing form e.cancel = true; //hide form this.windowstate = formwindowstate.minimized; } private void toolstripmenuitem1_click(object sender, eventargs e) { //hide icon tray notifyicon.visible = false; //get current process process proc = process.getcurrentprocess(); //kill , close programm proc.kill(); } but read little bit, kill() terminate work , "kill" process, think can not normal way close programm - data can destroyed or not stored also try use proc.closemainwindow(); , proc.close() - no effect on programm - windows closed, process still running. question: .kill() it's correct way close programm, or ther way it? ...

getting error when Adding new Page content: floor_type in drupal 7 -

Image
i want create new floor type page "interior design"("3" in image) content , category ( have 3 pages "tile & marble floors"(2 in image) "hardwood & laminate" "granite & carpets" ). other 3 pages working well. when want create new display "3" in image. conflicts "tile & marble floors" & "hardwood & laminate" pages. of content comes 2 pages:: 4 , 5 in image. please see image numbers. 1st :: create menu "interior design" 2nd:: created category 3rd :: created 5 contents (floor type) ::: content -> add new -> floor type 4th :: go page structure->view->floor type content there page screenshot have provided. in display section :: there button "+add" 5th :: clicked +add button "interiror design" (3 in image) others ::: "tile & marble floors" but problem "interior design" shows content of "tile & marble ...

visual studio - How to Change the "licensed to" user in VS2012 -

i trying change user shown on vs2012 splash screen next "licensed to" - ocd thing. i on windows 8 pro vs2012 professional. i have found online tells me to: open registry editor (start->run->type “regedit”->press enter) find following key: hkcu\software\microsoft\visualstudio\11.0_config\registration\username change it’s value desired name navigate following folder: c:\users\{your_user}\appdata\roaming\microsoft\visualstudio\11.0 (replace placeholder own username) delete file vs000223.dat – jpg file containing splash screen, can change it’s name see start visual studio, , magically recreates file modified name in it! so have followed these steps , changed registry keys (including windows nt ones) , say's delete vs000223.dat file. however, file doesnt exist, within c:\users{your_user}\appdata\roaming\microsoft\visualstudio\11.0 folder there 1 dat file - objbrowex.dat - deleting nothing - gets re-created. have done search , there no vs000223.dat i hav...

android - asynctask inside runnable does not stop after calling removeCallbacks -

i have asynctask named myasync performs network operations (fetching data server, , parsing json). i have handler created once activity runs. i have runnable in run asynctask. reason using runnable because using inside handler's postdelayed method want repeated every 1 minute. runnable runnable = new runnable() { public void run() { new myasync ().execute(); } }; then using above runnable inside onresume; @override protected void onresume() { super.onresume(); handler.postdelayed(runnable, 60000); } whenever leave activity, want check stop, calling, handler.removecallbacks(runnable); however, asynctask keeps on running non stop. shall ? the whole point of asynctask run thread on main thread. not make sense run in runnable()

graph - Storing data as an array/list on neo4j property -

i new neo4j , have following problem @ hand. trying develop social networking site wherein store message exchanged between 2 users on relationship property. this, trying store messages in form of array/list on relationship property. can please suggest if neo4j provides such types of operation. i know if insert message on relationship property , array/list updates(i.e adds new message on next index) for ex: user1 -> user2 : hi, whats user2 -> user1 : hi, in college relationship property stores message in form of list such as: ["hi,whats up", "hi, in college"] something in manner..... thanks neo4j supports array properties, see http://neo4j.com/docs/rest-docs/current/#rest-api-property-values . however i'm not sure if you're using modeling approach here. if store messages in array don't have timeline of conversation explicit in graph. worse if user1 sends 2 messages user2 without response user2 in between, you'll don'...

cocoa - NSOutlineView with 2 columns, text and check -

i have done : that nsoutlineview 2 columns, first column textcell , on second column drag , drop check box cell. now, set true rows : -(id)outlineview:(nsoutlineview *)outlineview objectvaluefortablecolumn:(nstablecolumn *) tablecolumn byitem:(id)item { if ([[tablecolumn identifier] isequaltostring:@"name"]) { return [item name]; } else if ([[tablecolumn identifier] isequaltostring:@"sel"]) { return @"1"; //for nsonstate //return @"0"; //for nsoffstate } } now want when user click on checkbox go nsoffstate , try inside method : -(void)outlineview:(nsoutlineview *)outlineview setobjectvalue:(id)object fortablecolumn:(nstablecolumn *)tablecolumn byitem:(id)item { [item setsel:nsoffstate]; } but don't go, how can ? help me !!! #import @interface appdelegate : nsobject { nsmutablearray *array; } @property (assign) iboutlet nswindow *window; ...

Is there a way to fold my code by default in Xcode? -

i have lot of method in classes , find folding them method line great way of keeping on top of stuff in class file. however, if close project , reopen folds no longer there. know there way of setting methods folded default or getting xcode remember have folded? i've never seen option this, in preferences file xcode. file radar requesting it.

Drupal - Which MySql table contains $footer message -

inherited mess. drupal 6 site custom theme has removed admin access. that's different problem though. immediately need change footer message text. since don't have admin access, need edit via mysql database. which drupal database table contains $footer message text? chris the site footer variable (as configured on /admin/settings/site-information page) stored in variables table. variables table has 2 columns: name , value . value stored in value column , identified site_footer in name column. so: select value variable name = 'site_footer' ...will give current value. note value serialized , make sure you're familiar how works if plan on trying change directly in database.

sencha touch 2 - get all store records even though filters applyed -

is possible can records though filters apply store. please provide guideline or reference code. var sparestore = ext.getstore('abc'); sparestore.filter( 'item', value); when alert sparestore count should rechords. u can use snapshot property of store : var allrecords = store.snapshot || store.data;

c# - Getting entity framework context in Linqpad? -

i've created dll assembly contains edmx northwind database. i created reference dll through linqpad , see db , able run queries. but - want test behavior of deferredloadingenabled property , need set via context variable. eg ctx.deferredloadingenabled = false; but how can access ctx ? linqpad generates me , , need access it. in entity framework 5, equivalent property is: ctx.configuration.lazyloadingenabled = false; if you're in linqpad, you're in context, can say: configuration.lazyloadingenabled = false; but when i'm copying code visual studio linqpad, i'll add line @ top code works same: var ctx = this;

c# - WCF: There was no endpoint listening -

this question has answer here: wcf - “there no endpoint listening at…” error 3 answers i try build application send messages between 2 machines usinf wcf , found article: http://tnvbalaji.com/articles/wcf-tutorials/ after follow steps , when server , client runs on same machine works fine. when try connect server other machine in same network received error there no endpoint listening. baseaddress = "http://localhost:8732/design_time_addresses/wcfmathservlib/mathservice/" so after run client machine have changed machine ipaddress instead of localhost in both app.config , still received error. btw firewall disable in server machine. problem ? try publish wcf service , deploy in iis. hosting website, require host wcf service enable access other machine. after hosting, browse service , use ip address service reference.

java - How to check if there is Data in a BufferedReader for 10 Seconds -

i'm using bufferedreader in java , know how can keep checking if there data in reader 10 seconds , stop checking. how achieved? have reads buffer once. how keep checking see if serverinput has data , react upon data? bufferedreader serverinput = new bufferedreader(new inputstreamreader(clientsocketconnection.getinputstream())); while ((stringinput = serverinput.readline()) != null) { system.out.println(stringinput); }; bufferedreader#readline() blocks until receive line of text. need set timeout underlying socket via socket#setsotimeout(int timeout) .

r - How to calculate Somer's D / C-index for an external validation dataset given a ordinal response -

i have fit proportional odds regression model using lrm function within harrell's 'rms' package. wondering how can calculate c-index / somer's d external validation dataset applied fitted model. these statistics can calculated fitted model directly using fitted.model$stats, unsure how them external validation dataset. there appear built in function doing binary or survival responses in 'rms' package, val.prob & val.surv , can't find method ordinal response. you should re-read documentation lrm . ordinal responses handled in function. run code using first example ?lrm generates "fit"-object: pred.logit <- predict(fit) phat <- 1/(1+exp(-pred.logit)) > str(pred.logit) named num [1:1000] na na na 0.234 0.577 ... - attr(*, "names")= chr [1:1000] "1" "2" "3" "4" ... > str(fit$y) named num [1:997] 0 1 0 1 1 0 0 0 0 0 ... - attr(*, "names")= chr [1:997] ...

jQuery, function called without parameters, but there is parameters -

one thing can't understand jquery, maybe can explain me this. for example: html: <div> <img class="class1" src="file.jpg" /> </div> <div> <img class="class2" src="file.jpg" /> </div> jquery: (function ($) { $(document).ready(function () { $('.class1, .class2').myfunction(); }); function myfunction(param1, param2) { var img = $('img', param1); } })(jquery); so question in param1 , in param2, if function has been called that(without passing parameters function)? the function call should follows: view: <div> <img id="img1" src="file.jpg" /> </div> <div> <img id="img2" src="file.jpg" /> </div> jquery: (function ($) { $(document).ready(function () { var path1 = $('#img1').attr('src'); var path2 = $('#img2'...

How to layout irregular shapes in Android layout -

Image
so graphics artist came me cool layout controls on our new app. problem getting these images laid out since views in android rectangular. see image have work with. any idea how layout these buttons shape around each other if makes sense? if problem layout, can draw buttons , save png. can layout app relevantlayout . , use "selector" change button image when user press on. selector example: "drawable/selector1.xml" <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/buttonclicked" /> <!-- focused , pressed--> <item android:state_pressed="true" android:drawable="@drawable/buttonclicked" /> <!-- pressed --> <item android:drawable="@drawable/button" /> <!-- default --...

actionscript - Issues with swapping 2 movieclips between alpha:1 and alpha:0 -

i have script when click arrow, 2nd item becomes visible , 1st goes invisible, goes on 4 items , on fourth goes first item etc. code isnt doing though, on first click 1st item remains , on second click 3rd , 1st item still visible, on 4th 4th item , 1st visible, after 4th click works fine. can me figure out? getting_started.alpha = 1; building_your_site.alpha = 0; web_enhancement.alpha = 0; site_maintenance.alpha = 0; leftarrow_mc.addeventlistener(mouseevent.click, rotateleft); function rotateleft(event: mouseevent):void { if (bottomwheel_menu_mc.rotation == 0) { tweenlite.to(getting_started, 1, {alpha:0}); tweenlite.to(site_maintenance, 1, {alpha:1}); } else if (bottomwheel_menu_mc.rotation == 90) { tweenlite.to(site_maintenance, 1, {alpha:0}); tweenlite.to(web_enhancement, 1, {alpha:1}); } else if (bottomwheel_menu_mc.rotation == 180) { tweenlite.to(web_enhancement, 1, {alpha:0}); tweenlite.to(building_your_site, 1, {alpha:1}); } else if (bott...

php - Retrieving Twitter Data based on twitter ID in codeigniter Using OAuth -

i using script fetch data of particular twitter user id the twitter user id 1897279429 i want show name , image i have following script using twitter library $this->load->config('twitter'); require_once apppath.'libraries/twitterapiexchange.php'; $settings = array( 'oauth_access_token' => $this->config->item('access_token'), 'oauth_access_token_secret' => $this->config->item('access_token_secret'), 'consumer_key' => $this->config->item('consumer_key'), 'consumer_secret' => $this->config->item('consumer_secret') ); /** perform request , echo response **/ /** note: set field before calling buildoauth(); **/ $url = 'https://api.twitter.com/1.1/followers/ids.json'; $getfield = '?username=saswatroutroy'; $requestmethod = ...

javascript - Keypress event doesn't work in internet explorer -

i have follow code: <input class="any" type="text" id="myid" name="myname" /> this input jquery datepicker.. ( http://jqueryui.com/datepicker/ ) my js follows: $('#myid').keypress(function(evt) { //codes }); i tried keypress, keydown , keyup.. not working in ie.. may because of jquery date picker plugin? i tried jquery hotkey plugin ( https://github.com/jeresig/jquery.hotkeys/blob/master/jquery.hotkeys.js ) but, no success :( i want capture enter event.. any help? felipe if element doesn't exist on page on initial load, event may not bound button. not sure why works in other browsers though. could possibly try see if helps $(document).on('keypress', '#myid', function() { // .... }); if you're using older version of jquery, you'll need use .live().

sql - Count how many times an integer is appears in a column -

i'm attempting find way count end of integer , display trailing value. example, have following table: credit ====== 1051000 10000 2066 16000 i'd able count amount of times '0' appears , end result following credit cntoccurancevals ====== ====== 1051000 3 10000 4 2066 0 16000 3 now have tried using query find of '0', problem i'm facing first row returns 4 instead of 3 searching whole row , not trailing. i've tried using find occurrence count declare @longsequence int(max) declare @findsubstring int(max) set @longsequence = credit set @findsubstring = '0' select (len(@longsequence) - len(replace(@longsequence, @findsubstring, ''))) cntreplacedvals, (len(@longsequence) - len(replace(@longsequence, @findsubstring, '')))/len(@findsubstring) cntoccurancevals is there way can find trailing 0's , not ones in middle of value? edit: ...

Is there a way to format in excel to turn the text into HTML? -

basically when enter text in excel cell, want (which centered): weight:10 lbs length: 21" width: 14" to become in cell: <p align="center"><font size="2" face="arial"></font><br></p><p align="center"><font size="2" face="arial">weight:10lbs<br></font><span style="font-family: arial; font-size: small;">length: 21"<br>width: 14"&nbsp;</span></p> i appreciate help! thank you! the other 2 answers both valid. solution not use vba. similar john's except uses multiple instances of substitute create new text template. assume values in a2-c2 (this arbitrary , discretion). template in $a$1 <p><br></p> <p align="center"><font size="2" face="arial"> {0}<br></font><span style="font-size: small;">{1}<br...

how to pass data from c# to c++ (just pointer, no marshalling) -

my application contains 2 sides - client side on c++ , server side on c#. need client side receive structure lowest possible latency. want receive pointer structure , avoid marshaling. structure that: struct orderaction { orderactiontype actiontype; uint userid; int ordersexecutorid; int instrumentid; int strategyid; .... so think want this: server c# side pass pointer client c++ side. at c++ side read , process struct received pointer. at c# side free resources (delete struct) if needed. in future plan replace c# server side c++ server side want client independent. client shouldn't know called , used c#. questions: should use algorithm? if @ step 1 should allocate structure @ managed memory or unmanaged memory? what methods should use , can link example? you'll first need double check struct blittable. if struct not blittable cannot avoid marshalling of form. stands, struct in question looks blittable, given fields have ...

Downloading a map image using Google Map using Java -

what want do: i want create little program in java (beginner in java here) in specify gps location , zoom level , download map image google maps showing. associated this, need have scale associated image (the size in km of x , y dimensions of rectangular image). what know: i know how right image displayed in browser, specifying gps location , zoom level directly in url (example: https://maps.google.com/maps?f=q&hl=de&geocode=&q=48.167432,+10.533072&z=7 ). there should kind of library urllib in python call url. how download image, , how know area pictured in it? found formula relate amount of meters (or whatever unit) "contained" in pixel (this function depends on latitude , zoom level of map). in case, how know pixels used map? thank suggestion and/or pointer! you want use static maps api. https://developers.google.com/maps/documentation/staticmaps/index your particular map @ url http://maps.googleapis.com/maps/api/staticmap?center...

javascript - Strict parameter matching in backbone.js router -

i've got router defined such: var myrouter = backbone.router.extend({ routes: { // catch-all undefined routes "*notfound" : "notfound", }, initialize: function(options) { this.route("my_resource/clear_filters", 'clearfilters'); this.route("my_resource/:id", 'show'); }, show: function(id){ console.log('show', id); }, clearfilters: function() { console.log('clearfilters'); }, notfound: function() { console.log('notfound'); }, }); var app = {}; app.myrouter = new myrouter(); backbone.history.start({silent: true}); thus following urls map as: var opts = {trigger: true}; app.myrouter.navigate('/foo', opts); // logged -> 'notfound' app.myrouter.navigate('/my_resource/123', opts); // logged -> 'show', '123' app.myrouter.navigate('/my_resource/clear_filters', opts)...

vim - How to make Syntastic search for javac config file in project -

i'm using syntastic vim , i've added external libraries classpath (using syntasticjavaceditclasspath ). creates file in current working directory (which project folder). fine. however, whenever restart vim, syntastic seems search .syntastic_javac_config file in current working directory only , , cwd is, of course, randomly whereever left in last operation. doesn't find file , bunch of incorrect import errors. can syntastic told search file's parents config file? if not, there way of using vim typically works? (i've been using vim couple of months might clueless.) according the official manual , snippet should solve problem. put in .vimrc , change javascript , jscs , etc. required values function! findconfig(prefix, what, where) let cfg = findfile(a:what, escape(a:where, ' ') . ';') return cfg !=# '' ? ' ' . a:prefix . ' ' . shellescape(cfg) : '' endfunction autocmd filetype javascript le...

loops - Java program involving substring() and charAt() methods -

my program supposed print out initials of name , print last name. eg. if name entered mohan das karamchand gandhi, output must mdk gandhi. although "string index out of range" exception. import java.util.scanner; public class name { public static void main(string[] args) { scanner s=new scanner(system.in); system.out.println("enter string"); string w=s.nextline(); int l=w.length(); char ch=0; int space=0;int spacel = 0; for(int i=0;i<l;i++){ ch=w.charat(i); if(ch==32||ch==' '){ space+=1; spacel=i+1; system.out.print(w.charat(spacel) + " "); } } system.out.println(w.substring(spacel,l+1)); } this culprit: spacel=i+1; system.out.print(w.charat(spacel) + " "); when i equal l - 1 , space1 going equal l or w.length() , beyond end of string.

asp.net - Codebehind not working -

this simple question ever asked here. learning asp.net on own using visual studio 2010. can't past first example of tutorial, , have no idea why. can't page_load event fire in codebehind. simple example follows: default.aspx: <@ page title="home page" language="vb" masterpagefile="~/site.master" autoeventwireup="false" codefile="default.aspx.vb" inherits="_default" %> <asp:content id="bodycontent" runat="server" contentplaceholderid="maincontent"> <asp:label id="mylabel" runat="server"></asp:label> </asp:content> default.aspx.vb partial class _default inherits system.web.ui.page protected sub page_load(byval sender object, val e system.eventargs) mylabel.text = "hello, world!" end sub end class when add <% mylabel.text = "hello, world!" %> default.aspx, label populated. can...

Curl: What Url could cause "CURLE_URL_MALFORMAT"? -

for testing purpose, need feed curl wrong url trigger "curle_url_malformat" error. no matter how try, couldn't make happen. error cannot resolve host, or unsupported protocol etc. tip. searching curl sources leads to... multiple tests supposed trigger same error. example, pop3://host:port/%0d%0a/1322

sql - Select column name and value from table -

if have following table in postgresql database: col1 col2 col3 1 b b 2 is there way column name each value without explicitly specifying column names ? i.e. have result set like: col1 col1 b col2 col2 b col3 1 col3 2 of course, write pl/pgsql function , query catalog table pg_attribute yourself. it's easier 1 of following: json the function row_to_json() provides functionality goes half way. introduced postgres 9.2 : select row_to_json(t, true) tbl t; you don't have mention column names @ all, function derives them table type. ->sqlfiddle demo. but you'll need json_each_text() postgres 9.3 go way: select json_each_text(row_to_json(t)) tbl t; to sort order display: select (json_each_text(row_to_json(t))).* tbl t order 1, 2; (it's unclear how want sort exactly.) untested. sqlfiddle not provide postgres 9.3, yet. hstore however, can same additional modul...

c++ - Why is my cin is not working -

hello fsu student started programming , confused why cin not working. know code looks funny aren't allowed use lot of stuff yet while statements , such. posted code below. main question why after type cin >> quantity; nothing happens in program. cout << "-------------------------------------" << endl; cout << " florida state university" << endl; cout << " ticket information dept." << endl; cout << "-------------------------------------" << endl; cout <<""<< endl; cout <<""<< endl; cout << "please, enter name" << endl; cin >> name; cout << "how many florida state university credits have completed?" << endl; cin >> credits; if (credits <0) { cout<< "bad data recieved." << endl; } else { if (credits <=30) { ticketamt=2; ...

github - Git fatal: index-pack failed -

i tried cloning git repository local folder , error. used tortoisegit version 1.8.5 (64 bit) git.exe clone --recursive --progress -v --depth 1000000 "https://github.com/myrep/dotnet.git" "c:\projects\pfm\dn1\dotnet" cloning 'c:\projects\pfm\dn1\dotnet'... post git-upload-pack (221 bytes) post git-upload-pack (230 bytes) remote: counting objects: 10572, done. remote: compressing objects: 100% (3317/3317), done. receiving objects: 100% (10572/10572), 60.57 mib | 843 kib/s, done. resolving deltas: 100% (7373/7373), done. remote: total 10572 (delta 7373), reused 10047 (delta 6848) fatal: index-pack failed git did not exit cleanly (exit code 128) (82009 ms @ 24-09-2013 21:28:10) please me resolve this. update: working fine in india, moved uk , when tried here not working :) wondering this. there server configuration problem? if same thing in remote machine in india, works fine. :) have no idea on it i got error when git ran out of memo...

CSS unicode trigger character not working with Safari + other Apple products -

i'm using wordpress plugin called collapse-o-matic on website: antiskrid.dk . i've replaced default "trigger" background-image expanding/collapsing css unicode graphic shape, , shows nice , clear in browsers on every device i've got hands on. my problem is, trigger doesn't work in safari on pc, safari + chrome on ipad , default android browser. the trigger works chrome android , safari on iphone 5 though. the original css looks this: .collapseomatic { background-image: url(images/arrow-down.png); background-repeat: no-repeat; padding: 0 0 10px 16px; cursor: pointer; } .colomat-close { background-image: url(images/arrow-up.png); } this of course works in browers on platforms. the problem occurs when i'm using modified css: .collapseomatic { background-image: none; padding:0; } .collapseomatic:after { content:"\25bc"; } .colomat-close { background-image: none; } .colomat-close:after { content:"\25b2"; } i've tri...

c# - Split alphanumeric string to array containing the alphabet and numeric characters separately -

i'm looking find way split alphanumeric string like "foo123bar" into array contains so array[0] = "foo" array[1] = "123" array[2] = "bar" i'm not sure best way achieve is, because strings i'm comparing follow no specific pattern far first, alphabet or numbers, or how many times each appear. example of following: "foo123bar" "123bar" "foobar123" "foo123bar2" i'm trying find out if there more efficient way of doing other splitting string character character , checking see if it's numeric. string input = "foo123bar"; var array = regex.matches(input, @"\d+|\d+") .cast<match>() .select(m => m.value) .toarray();

java - Change Icon dynamically in JTable -

i have jtable jlabel show given picture if person approved(or failed) in test.i use renderer: public class testcellrenderer extends jlabel implements tablecellrenderer { list<student> list=null; public testcellrenderer(list<student> l){ super(); this.list=l; } @override public component gettablecellrenderercomponent(jtable table, object object,boolean isselected, boolean hasfocus, int row, int column) { student s=list.get(row); if(s.getpoints()>=90){ seticon(new imageicon(getclass().getresource(okay_path)));} else if(s.getpoints()<90){ seticon(new imageicon(getclass().getresource(error_path))); } } sethorizontalalignment(jlabel.center); return this; } }//end renderer it works flawless until have edit student in jtable row.i open screen contents of row edition.of course, table mod...

c# - hiding an asp.net generated <span> breaks my javascript form validation -

so using javascript validate address field pull zip code off end. i have 2 asp:labels show , hide inform user. works great, labels show when needed , validation works how want it, problem comse when try hide them. 1 of labels shows , hides fine, whenever try hide other script breaks <script> function isvalid() { var zip = maincontent_tbx_appt_address.value.slice(-5); if (zip == "") { maincontent_lbl_add_validate2.hidden = true; maincontent_lbl_add_validate.hidden = false; } else if (!zip.match('[0-9]{5}')) { //maincontent_lbl_add_validate.hidden = true; maincontent_lbl_add_validate2.hidden = false; } else { //maincontent_lbl_add_validate.hidden = true; maincontent_lbl_add_validate2.hidden = true; } } </script> <...

Create a custom type with constraint in Go -

how create custom type in go valid values can accepted? example, want create type called "names" underlying type string. can accept values "john", "rob" or "paul". other value return error. i've create following program in simplistic way represent achieve. http://play.golang.org/p/jzzwalsixz what best way write code? you ( http://play.golang.org/p/jair_0a5_- ): type name struct { string } func (n *name) string() string { return n.string } func newname(name string) (*name, error) { switch name { case "john": case "paul": case "rob": default: return nil, fmt.errorf("wrong value") } return &name{string: name}, nil } golang not provide operator overload can't make check while casting or affecting value. depending on trying do, might want ( http://play.golang.org/p/uxtnhknrxk ): type name string func (n name) string() string { ...

desire2learn - Valence API that replaces the older WS UserManagementService -

one of our integrations uses d2lws usermanagementservice convert username userid. receive username, firstname , lastname of student when click through lti request, need numeric userid of other valence api calls. we reduce our dependency on d2lws before retired, wondering if there equivalent valence api call can used conversion? there many ways client application fill out understanding of lms user identity's properties. noteworthy remember d2lws platform optimized service-to-service level operational trust, while newer valence platform optimized user-to-service operational trust -- means valence calls must happen in context of some real, authenticated lms user account (in sense in order make calls, client application must first request acquire user id/key pair authenticated user). if client service contacted or prompted lms lti launch, have enough capacity launch begin (please see detailed topic on combining valence calls lti around our remote plugin service ). th...