Posts

Showing posts from March, 2010

What is 'AskTbPTV' in HTTP User Agent? -

searched on google couldn't find useful. programming statistics user agents , came across one: mozilla/4.0 (compatible; msie 6.0; windows nt 5.1; sv1; mra 5.8 (build 4157); .net clr 2.0.50727; asktbptv/5.11.3.15590) what 'asktbptv' in http user agent stand for? ask.com toolbar http://apnstatic.ask.com/static/toolbar/everest/download/index.html?source=sp wich modify user agent string.

c++11 - Largest Seed Possible for Mersenne Twister c++ -

i find out largest value can seed random number generator in c++. code follows: mt19937 myrandomgenerator(seed); how large can variable, seed be? have noticed if value becomes large, random number generator spits out same sequence of 'random' numbers. know how large seed can without happening. seed std::uint_fast32_t 32-bit int. every value in range [0..2^32) should produce different results. if seeing same sequence 2 different seed values, either making observational error , seed inputing same, or there bug in standard library implementation. prepare short self-contained test program demonstrating misbehaviour , post here.

scriptcs hosting - Advantages over Roslyn -

if want support scripting in application, scriptcs offer particular advantages on using plain vanilla roslyn script engine? unfortunately there's not documentation on hosting scriptcs yet, i'll try give short summary. hosting scriptcs in application provides several features vanilla roslyn doesn't: pluggable engines while scriptcs comes roslyn , mono engines default, can replace engine, i.e. f# , lolcode or brainfuck . pre-processing scriptcs process scripts , extract things references ( #r ) , load other scripts ( #load ). there introduced custom ilineprocessor s lets hook pipeline custom processing. example processor this: public class gistlineprocessor : directivelineprocessor { protected string directivename { return "gist"; } protected override bool processline(ifileparser parser, fileparsercontext context, string line) { var gistid = getdirectiveargument(line); var gistcontents = downl

sql - MySQL: Using alias in select arithmetic - Unknown field -

here's select: select sum(t.amount + c.designfeevalue) cashreceived, round(sum(i.value) * (m.percentours / 100)) advalue, m.managementfee managementfee, m.productioncost productioncost, 5 emailaddress, ( ( select value commission_transactions isdebit true ) - ( select value commission_transactions isdebit false ) ) miscexpenses, (managementfee + productioncost + emailaddress + miscexpenses) totalexpenses this bombing because of following line, add aliases. (managementfee + productioncost + emailaddress + miscexpenses) totalexpenses the aliases unknown fields. is there way can keep aliases arithmetic or need re-do math generates each alias calculation of totalexpenses? seems ugly way it. update: per suggestions, using derived table. select cashreceived, advalue, managementfee, productioncost, emailaddress, miscexpenses, advalue + managementfee + productioncost +

android - NullPointerExeption in SimpleCursor adapter.Works with onLocationChanged() -

i hava database places , coordinates. want create fragment, hava list of places more 5 kilometrs me. code is: i start fragment next: case r.id.btn_near: if(isonline()){ ft = getsupportfragmentmanager().begintransaction().replace( r.id.content_frame, frg); ft.commit(); } else toast.maketext(this, "Подключите интернет", 1000).show(); break; fragmentnear.class public class fragmentnear extends fragment implements android.location.locationlistener { cursor c; view v; listview lvmore5; database db; protected locationmanager locationmanager; string lat; string provider; protected string latitude, longitude; protected boolean gps_enabled, network_enabled; double mylat, mylong; simplecursoradapter scadapter; string[] from; int[] to; @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { log.d("mylogs", "-----

batch file - Windows Command dir /a/q/s > printout.txt -

i able run command dir /a/q/s getting information need. when run such dir /a/q/s > print.txt or dir /a/q/s > print.dat or dir /a/q/s > print.xlsx print out onto file not give me information. cuts off information. ideas? thanks.

ios - Simulate UIScrollView Deceleration -

i have uipangesturerecognize use change frame of view. there way simulate deceleration of uiscrollview or uitableview when gesture's state uigesturerecognizerstateended ? here current code: if (pangesture.state == uigesturerecognizerstateended) { [uiview animatewithduration:0.25 delay:0 options:uiviewanimationoptionbeginfromcurrentstate animations:^{ self.view.frame = cgrectmake(182, 0, self.view.frame.size.width, self.view.frame.size.height); } completion:^(bool finished) { if (finished) { //do } }]; } but not smooth scroll. decelerates until stops point i've set. thanks session 223 @ wwdc 2012, "enhancing user experience scroll views", covered method use scrollview's behavior , "feel" animate position of different view (without scrollview ever being visible user). the benefit of method shown in session deceleration match uis

c++ - Ruby 2.0 CSV write special permissions? -

i wrote script in ruby (ruby 2.0 on winxp, 32 bit) query database , write results csv-file. works fine long call script cmd or batch file. when call script programm (controller robotics platform) can database query i'm not able write csv. part of code use create , write csv: csv.open('out.csv', 'wb') |csv| csv << ["barcode", "labid", "obtained", "freezed", "sz", "comment"] csv << [barcode, labid1, obt1, freezed1, sz1, comment1] end this creates csv-file headers , corresponding data. quite simple , works cmd , out of batch files not robotics controller uses kind of c-code. strange thing can parse data robot script , data executed in script (i can control in console) i'm not able last step create file through robotics controller. special case maybe came across similar ? appreciate help. thanks.

select neighbors and find Top n in Matlab -

this question has answer here: get indices of n largest elements in matrix 3 answers if have matrix this: sample = [1 0.21852382 0.090085552 0.219984954 0.446286385; 0.21852382 1 0.104580323 0.138429617 0.169216538; 0.090085552 0.104580323 1 0.237582739 0.105637177; 0.219984954 0.138429617 0.237582739 1 0.192753169; 0.446286385 0.169216538 0.105637177 0.192753169 1 ] i want find top 3 max values in every rows in matlab. in matlab? , true? want find top-n method in select neighbors. i recommend rewording question. want top ten max values in every row, matrix gave has 5 columns :/ i think looking this. sample = [1 0.21852382 0.090085552 0.219984954 0.446286385; 0.21852382 1

javascript - How to make an element parent of another div forcefully -

i've come 3 problems. know, javascript can fix it. but, don't know javascript well. so, need help. (1)i've make element "class dropdown" parent div of "div c" forcefully. example, structure: <div class="a"> <ul> <li class="dropdown"><a href="#">about</li> <li><a href="#">about</li> <li><a href="#">about</li> </ul> </div> <div class="b"></div> <div class="c"></div> i know, 1 or 2 lines javascript code make that. but, don't know code. so, what's javascript code makeing li.dropdown parent of "div c"? (2) how close div onclick option? structure: <a href="#" class="collapse"></a> <div class="main-nav"></div> by default, main-nav display: none when, click on collapse link, main-nav div

html - Change width of TABLE based on its TD cells -

Image
i looking way specify table's width specifying widths of tds. in following scenario ( try live on jsfiddle ) can see have specified width of each td 100px , expected 300px table (and horizontal scrollbar div) in practice browsers give them width of 63px (that's table's width divided 3) is there way make tds determine width of table , not other way round? far have tried different values of table-layout, display, overflow td , table without success. the html: <div> 200px <table> <tr> <td>100px</td> <td>100px</td> <td>100px</td> </tr> </table> </div> and minimal css: div { width: 200px; height: 300px; border: solid 1px red; overflow-x: scroll; } td { width:100px; border: solid 1px #000; } table { border-collapse: collapse; } a simple solution make td's content 100px wide. &

c# - linq-to-sql asp mvc - where access to the data context? -

good day everyone! currently working on project in asp-mvc 2 linq sql handle database. i see many documentation linq sql in asp mvc, question is, exactly access data context? place better performance? for example, have mydbdatacontext class i can define in controllers public class imaginarycontroller : controller { mydbdatacontext context = new mydbdatacontext (); public actionresult index() { var list = // code read context return view(list); } } ....... or, in action methods public class imaginarycontroller : controller { public actionresult index() { mydbdatacontext context = new mydbdatacontext (); var list = /* code read context */; return view(list); } public actionresult create() { //but create need reference mydbdatacontext context = new mydbdatacontext (); var list = /* code read context */; return view(list); } } another option cr

c# - Removing elements with Except -

below have method supposed delete versions of file except newest. except call not producing result i'm expecting , after looking @ docs once again can't seem understand why. purpose of debugging i've moved linq query except out of foreach condition. when debug newest correctly set recent log file, after next line executes todelete still contains newest , why? missing here? relevant code below. method gets called passing file set static part of log name, after has time stamp. both where(x => x.contains(file)) work expect them to. public static void cleanuplocalcopies(string file) { string[] localfiles = directory.getfiles(".\\"); string newest = files.where(x => x.contains(file)).orderbydescending(x => x).firstordefault(); var todelete = localfiles.where(x => x.contains(file)).except(new string[] { newest }); foreach (string f in todelete) { file.delete(f); } } in case, can use skip skip first file d

How to redirect URLs through .htaccess? -

i want change domain name of website. i want .htaccess redirect urls new domains in such way that: when users click on urls http://old-domain.com/my-site-link/ redirects http://new-domain.com/my-site-link/ and when users click on urls http://old-domain.com/my-site-link.php redirects http://new-domain.com/my-site-link.php new domain used , old domain not. how possible? code .htaccess? if both domains on same account , same root folder can use this: rewriteengine on rewritecond %{http_host} ^(www\.)?old-domain\.com$ [nc] rewriterule ^(.*)$ http://new-domain.com/$1 [r=301,qsa,l] if domains on either different accounts or hosting services can simple add rule old domain .htaccess . rewriteengine on rewritebase / rewriterule ^(.*)$ http://new-domain.com/$1 [r=301,qsa,l]

javascript - How to get a Touch object from a TouchEvent -

looking @ mozilla's reference touchevent, see no obvious way (one) touch object caused event. maybe because i'm misunderstanding how these things work. if following true, make sense me: if multiple touch events of same type happen, event handler called once , programmer expected handle multiple events using touchevent.changedtouches touch events of different types call 2 different handlers separately (eg. if touchstart happens @ same time touchend) is guess correct? if so, answer main question loop through changedtouches , handle each separately (unless have special logic). the 'touchstart' event fired list of changedtouches, can 1 or many. guess correct, have loop through changedtouches , treat them separately. take @ portion of documentation provide examples: https://developer.mozilla.org/en-us/docs/web/guide/dom/events/touch_events#tracking_new_touches

jsf - Not allow special characters and only upper case p:inputText Primefaces -

well, have <p:inputtext> in primefaces, want know how can allow uppercase word , no special characters. ex: renato calhaça = renato calhaca "renato".touppercase() convert string uppercase. take @ java.text.normalizer converting (some, not all) accented characters standard. to disallow lowercase and/or special characters should use validator. simple regex identify special characters [^a-za-z0-9] or special , lowercase characters [^a-z0-9] . validator can modify input using 2 methods indicated above - though may want make sure user knows happening.

redhawksdr - Setting Component Property from REDHAWK Control Panel -

i'm working on redhawk control panel. i've been able bind sca component property swt text widget , keep them in sync. however, cannot find method set sca component property redhawk control panel. example, trying set value of simple float property in sca component after swt button widget pressed (using selectionevent). is should expect able do? if so, how? dug through gov.redhawk.core code, didn't have luck. thanks! in order update component property need locked reference sca simple property. done follows scamodelcommand.excute(property, new scamodelcommand(){ @override execute() { property.setvalue(newvalue) } });

javascript - Disabling LocalStorage on PhantomJS for clean testing? -

just started working casperjs few days ago. i create script today test how localstorage behaves , if disable because that's necessary in order keep tests affecting each other. background i'm working on backbone wizard ask value on first page. when click continue button, saves value localstorage displays on second page. i'm using casperjs test <script.js> both , without --local-storage-quota=0 . first attempt wrote casperjs script following: load page check contents of model (empty, should be) click continue check contents of model after page 2 loads (contains value, should) open page 2 directly new page using casper.thenopen() check contents of model after page 2 loads if localstorage enabled, step 6 should have same result step 4 (value exists in model). if localstorage disabled, step 6 should have same result step 2 (model empty). everytime ran script, determined localstorage enabled. '--local-storage-quota=0' parameter ma

Adding Layout to a ViewGroup Android -

i have flying in menu based on viewgroup. want there basic layout , in activity able insert view group new layout , afterwards erase it. but doesn't work!!! can me please. class: @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); this.root = (flyoutcontainer) this.getlayoutinflater().inflate(r.layout.activity_main, null); this.setadditionallayout(findviewbyid(r.id.physical_layout)); this.setcontentview(root); } viewgroup: <com.nurielweizmann.calculator.view.viewgroup.flyoutcontainer xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="

vba - How to copy the data of FILTERED data from one sheet to another with same format -

i have similar question in link copy rows contents , formatting (to sheet) i'm trying copy data 1 sheet sheet in same workbook below code , i'm able copy, format of cells getting changed after copying, how can copy data same cell formats (with same length, width , color etc) with activesheet .usedrange.specialcells(xlcelltypevisible).copy end activeworkbook.worksheets(newsheet).select activesheet .range("a1").select selection.pastespecial paste:=xlpasteallusingsourcetheme, operation:=xlnone _ , skipblanks:=false, transpose:=false end .pastespecial xlpasteall .pastespecial xlpastecolumnwidths

jquery - How to refresh ajax results based on link clicked -

i have problem. i'm sending ajax request , data load right results depending on link that's click. when click different link , request results reflect link. retains value previous link. appreciated. here's i'm doing. here's ajax call $('body').on('click', 'button', function () { $.ajax({ url: fullurl, type: "get", datatype: "json", ifmodified: true, success: ondatareceived, error: onerror//, // data: data }); }); now when click button right values first time, when click different link change 1 of values result doesn't change. it's caching results. i've tried setting cache false, clearing browser cache avail. doing wrong my success function this function ondatareceived(series) { // push new data onto our existing data array count = 0; (var prop in series) { if (series.hasownproperty(prop)) ++count; }

x86 - List parameters to a function from binary executable -

i'm looking analysis on binary executable of program create list of parameters specific function call. can use ollydbg find list of calls function, don't see show parameters without executing code. it looks function takes 2 parameters, each supplied simple push directly before call in each instance. can use distorm pore on code single instance, i'd prefer more general solution can use elsewhere. ollydbg seem know number of parameters when stepping function, i'd think it's possible determine number of parameters through static analysis, understanding of x86 assembly limited. is there existing way this, or option use distorm , grab last 2 push statements before each call function? the way think of doing going through function , checking references ebp . in function prolog, typically see: push ebp mov ebp, esp sub esp,n this new function stack frame being set up. bit this ebp+n -> arg n ... ebp+8 -> arg 0 return addres

javascript - WSAPI Max Page Size -

it nice if wsapi allowed larger maximum page size. there many instances pulling several thousand work items, , in need of 1 field in record. having pull records 200 @ time means long wait times user while hundreds of individual pages loaded. the lbapi page size should indication possible. it's max page size (if remember correctly) 10,000. realize it's returning less information per record (oids instead of full objects) optimizations made wsapi in regards bandwidth (not returning full collection detail) seems 200 awfully low. there 2 problems here contributing slowness here. first small page size. there internal discussions happening right bumping 1000 (especially since in v2.0 collections aren't returned in request). the second right wsapidatastore paging serially. first page has loaded serially, after remaining n-1 should able done in parallel. there defect tracking second item addressed soon. first item attention well.

blueprint osgi - Suppress delimiter option in Camel Recipient List -

we have custom camel processor needs invoked , parametrized dynamically incoming request payload xpath, uri of processor contains 'comma' makes sql query internally <context id="mycontext"> <from uri="timer://com.arpit.timer?period=1000&amp;delay=1000&amp;repeatcount=5&amp;fixedrate=false&amp;daemon=false"/> <setbody> <simple> "here goes sample xml payload "</simple> </setbody> <setheader headername="val1"> <xpath resulttype="java.lang.string"> "here goes xpath" </xpath> </setheader> <!-- call custom processor uri containing comma --> <recipientlist delimiter="%"> <simple>select col1, col2, col3 tablex id = '${header.val1}'</simple> </recipientlist> </context> now scenario works when give delimiter="%" otherwise, fails er

javascript - Find string with "//" and replace from "//" up to the end -

supposed inlinediv_num_text has value of: //abc must replaced @comment@ and abc //cde must replaced abc @comment@ please fix condition did, it's not working //wrap inline comments if(/[^]*//[^]*/g.test(inlinediv_num_text)){ inlinediv_num_text = inlinediv_num_text.replace(///[^]*/g, "@comments@"); } you have escape each \ . try changing search regex /\\\\\s*/ http://rubular.com/r/qh0wwd2wnh note: languages require escape \ twice. 1 base language, , 1 regex. if above doesn't work, might need along lines of /\\\\\\\\\\s*/

php - jQuery Autocomplete one input, then populate other relevant inputs? -

Image
i'm using formidable pro wordpress plugin create editable forms. each form has several different "contact info" areas (in below picture, 1 such area "general contractor", , 1 "mechanical engineer"), , each area has several inputs. what i'm looking create: enter first few letters of persons name in "contact" input select name resulting autocomplete drop-down populate nearby fields contact's respective information (company, email, phone, fax, tax id, , address) the first image below shows 2 of "contact info" areas (the first of drew in each input's id). second image shows how each contact's information stored in mysql table. so there autocomplete wordpress or jquery plugins can me accomplish this, , if so, how go implementing feature? i'm guessing drop-downs you're using dynamic fields? replace these lookup fields , can automatically populate values of other fields so: for each f

c# - WPF how to wait for binding update to occur before processing more code? -

as understand dispatcher takes place in thread, takes care of updating data bindings, layout, etc. however, there way wait until dispatcher has no more items or @ least no more data bindings? want ensure property change has updated of components , run dependent property changed callbacks before running more code. edit: guessing not needed, trying understand should have done instead. main question @ wpf if children of scrollviewer resize, scrollviewer automatically update extent? but curious whether wait bindings update or if there guarantee 1 binding updates before another? expected code such order of binding updates not matter? used dependency property changed callback's perform various stuff dependent on other properties updating the dispatcher has several priorities processing single tasks. i'm quite sure cannot change priority of callbacks of dependency properties. if changed data binding, in queue dispatcherpriority.databinding priority. manipulate values

java - Hibernate: Object deleted but still can be loaded by Hibernate -

it seems absurd how after deleted object can load , print id. here's class use retrieve data prof entity : public class profcrud { sessionfactory sessionfactory = hibernateutil.getsessionfactory(); session session ; public arraylist<object> findprofbyprofid( int id){ session = sessionfactory.opensession(); query q = session.getnamedquery("findprofbyprofid"); q.setlong("id", id); list<object> objet = q.list(); session.close(); return (arraylist<object>) objet; } public void deleteprofbyprofid(int id){ profcrud pc= new profcrud(); session = sessionfactory.opensession(); session = hibernateutil.getsessionfactory().opensession(); transaction transaction = null; try { transaction = session.begintransaction(); prof c = (prof) pc.findprofbyprofid(id).get(0); session.delete(c); transaction.commit(); } catch (hibernateexception e)

entity framework - Error 3033: Prblm in mapping fragments:EntitySets 'Entity1' and 'Entity2' are both mapped to table 'Addresses'. Their primary keys may collide -

context. want separate shipping table 2 tables, first 1 general data shipping used , in second table store pickup , destination addresses in different records selector field recordtype, in order retrieve addresses information when required. purpose, created 3 entities, entity move shipping general information, entity pick address , entity destination address, last 2 entities have additional field "address type" distinguish pickup , destination. mapping details screen in model mapped both entities, pickupaddress , destinationaddress same table moveaddresses, pickupaddress codition recordtype =”p” , destinationaddress condition recordtype = “d”. when rebuild datalayer solution got following errors error 2 error 3032: problem in mapping fragments starting @ line 625:condition member 'moveaddresses.addresstype' condition other 'isnull=false' mapped. either remove condition on destinationaddresses.addresstype or remove mapping. error 4 error 3033:

java - JSI RTree implementation "contains" method giving incorrect results? -

i trying use jsi rtree implementation https://github.com/aled/jsi index geo locations application. load 7m entries , query using contains method bounding box around states of massachusetts , connecticut. results come not in bounding box. user error or bug in rtree implementation? here bounding box: rectangle r = new rectangle(-73.630f,43.185f,-69.675f,40.946f); one of many incorrect results returned one "lon" : -74.24565887, "lat" : 40.66231918 ...but many of them farther out of box. i have checked haven't accidentally mapped ids in index incorrectly wrong data. when did initial testing added couple dozen points index , queried bounding box , found results accurate. i'm stumped. has advice. author of jsi here. initial thoughts problem way you're using library. if raise issue on github enough information reproduce i'll take look.

c# - how to search keyword in different website using google searching -

i want search keyword in google. have tried following code enter keyword , click search button through c# program. private void webform_load(object sender, eventargs e) { webbrowser1.height = 1000; webbrowser1.width = 1000; this.controls.add(webbrowser1); webbrowser1.documentcompleted += new webbrowserdocumentcompletedeventhandler(webbrowser_documentcompleted); this.webbrowser1.navigate("www.google.com.au"); } my documentcompleted method is: public void webbrowser_documentcompleted(object sender, webbrowserdocumentcompletedeventargs e) { var webbrowser = sender webbrowser; webbrowser.documentcompleted -= webbrowser_documentcompleted; htmlelement textelement = webbrowser.document.all.getelementsbyname("q")[0]; textelement.setattribute("value", "mlm company"); htmlelement btnelement = webbrowser.document.all.getelemen

c++ - boost::shared_mutex vs boost::mutex for multiple threads writing? -

i have scenario multiple threads writing common buffer (a map), each thread or not have same key. can please advise on whether should use boost::shared_mutex or boost::mutex? understanding boost::shared_mutex single writer , multiple reads not want. make boost::mutex more appropriate scenario? thanks in advance yes, boost::shared_mutex not case don't have pure readers , have multiple writers. use boost::mutex enforce exclusive access shared data.

ios - CoreBluetooth Central Manager cannot discover peripheral in background -

i have application utilizing bluetooth 4.0 le. application allows device act central , peripheral. i want application run in background. have included uibackgroundmodes "bluetooth-central" , "bluetooth-peripheral" in info.plist already. i running application on 2 different devices bluetooth 4.0 le enabled. when both devices running in foreground, works , information passed both ways. when 1 device running in foreground , other running in background, device running in background able scan , advertise, unable discover other device running in background. device running in foreground able discover , connect device running in background. after reading through apple's core bluetooth programming guide , know connecting device , sharing information both ways possible. i can post more information upon request. thank you. when peripheral app backgrounded , advertised services pushed "overflow area" , peripheral name not advertised @ all.

box api - Getting events - but only tree changes -

we using box api events endpoint track events in users account. we looking way only events related adding or modification of folders , files. problem following: if set stream_type=changes don't receive collab_add_collaborator event cannot detect when new folder appears in user's account. if set stream_type=all events , majority of them not needed our use case. basically, need stream_type return events result in filesystem changes in user's account (basically stream_type=changes including new files , folders created via share). is maybe bug in stream_type=changes ? sounds bug. check on @ box.

html - Cross-Screen support for navbar -

i have created nav bar page not support multiple screens how can make support them? htm: <section id="container"> <section id="header"> <span id="icon">icon</span> <input type="text" name="search_box" id="search_box"> <nav id="dropdown_menu"> <ul> <li>dropdown <ul> <li>item 1</li> <li>item 2</li> </ul> </li> </ul> </nav> <div class="vertical_bar" style="float: right; margin-right: 3%;"></div> <div id="notifications"> <span id="num_notifs">4</span> l</div> <nav id="menu"> <ul> <li>h

php - get iframe title and echo in html -

this question has answer here: how can title of html page using php? 1 answer load iframe src address bar like: http://site.com/demo.php?go=http://google.com <!doctype html> <html> <head> <title></title> </head> <body> <iframe src="<?php echo $_get["go"];?>"> <p>your browser not support iframes.</p> </iframe> </body> </html> want iframe title , echo in demo.php title tag… possible? use javascript instead. this: var iframetitle = document.getelementbyid("myiframe").documentelement.title

c# - Convert string to char error message -

cannot convert string char error message. trying able write program will, example, allow user input 1800hiethc , give them digits. stuck.... or advise on do? static void main(string[] args) { char number = ' '; int numb = 0; console.writeline("please enter telephone number..."); number = console.readline(); while (number <= 10) { if (number == 'a') { numb = 2; } } console.writeline(numb); } } } console.readline gives string a string is, among other things, collection of char s try this string number = ""; int numb = 0; console.writeline("please enter telephone number..."); number = console.readline(); for(int i=0; i<number.count; i++) { if (number[i] == 'a') { //... } }

How do I include in my Eclipse project, native Android code located in a directory external to my project? -

i have android test project includes jni code elsewhere in repository. instance, android.mk file resembles following: local_path := $(call my-dir) include $(local_path)/../../../android.mk i have opened project in eclipse, enabled native support, , switched android native perspective. project builds , runs correctly. my problem native c++ code not present in eclipse workspace. can't see under jni folder or under of project's sub folders. question is, how include native code in workspace can edit it, , set breakpoints (via sequoyah)? you can add linked folder eclipse project, see http://www.russellbeattie.com/blog/1002305

How do I add newline within text string to zipfile using python 2.7 -

writing text zipfile using python. below if section of code using this. can't figure out character need use add new lines zipfile. if count: textx = "the following species present:" blurb = "\r\ninsert table here\r\n\r\nsa* - south america\r\nna** - north america\r\nca*** - central america" else: textx = "no species present." blurb = "" right "if count" true, output in document looks this: insert table here sa* - south america na** - north america ca*** - central america i want this: insert table here sa* - south america na** - north america ca*** - central america below other pertinent script snippet might troubleshoot. script 600+ lines long why did not include whole thing. everyting works except piece. replacetext = {"textspecies" : textx, "textblurb" : blurb} template = zipfile.zipfile("c:\\template.docx") response = zipfile.zipfile(results, "a&quo

python - Problems Accessing dictionary in Django -

i able access dictionary fine in django python shell using p['cover']['source'] . can access 'source' in templates using dot notation, however, when attempting access p['cover']['source'] in views keyerror. able access 'cover' using p.get('cover','none') need p['cover']['source'] , have no idea how access this. please :-) views.py image_table = [] n in likes: link = n.facebook_id p = graph.get_object(str(link)) #image = p['cover']['source'] //this returns keyerror #image = p['cover'][0]['source'] //this returns keyerror = 0 image = p.get('cover','none')//this returns first dictionary image_table.append(image) some users may not have cover picture, causing keyerror when access dictionary. use try/except block prevent error: try: image = p['cover']['source'] except keye

html - <br style="margin-bottom:8px;"/> not rendering in IE -

i'm trying create space , half between text , date in website without using 2 "< br/ >" tags. code see below works fine in firefox doesn't work @ in ie. if use 2 "< br/ >" tags, creates space , want 1 space , half without using css. know can css code have works fine in ff , doesn't work in ie. think reason ie doesn't "margin-bottom" , it's not rendering all. code: <p class="text">blah blah blah<br style="margin-bottom:8px;"/>17 august 2013, 2:30pm est</p> output in ff: blah blah blah blah 17 august 2013, 2:30pm est output in ie: blah blah blah blah 17 august 2013, 2:30pm est you use 2 p tags , control margin on them or use line-height give want. can't comment without seeing more of code. but try whilst waiting answer.

ios - Can I use RestKit 0.20.3 to submit a request with OAuth parameters required by Yelp? -

i writing ios app requests data yelp. i have code manages yelp requests/responses , parses json data returned internally. current code builds oauth parameters requests using oauthconsumer jon crosby. i came upon restkit yesterday, , found appealing. eliminate of request submission , response parsing doing. but hit roadblock, because have not been able figure out how generate oauth parameters yelp requires restkit. worked through ray wenderlich restkit tutorial @ http://www.raywenderlich.com/13097/intro-to-restkit-tutorial , uses client id , client secret (as required foursquare). yelp requests need have consumer key, token, signature method, signature, timestamp , nonce. have been unable find add-on restkit can generate particular set of oauth parameters. i generating restkit requests using afoauth1client developed matt thompson. yelp api returning invalid signature error when send request. i puzzled because have checked fields in http authorization header, , correct.

c++ - Get the HTML of a site -

i'm trying string (or char[]) html of page...( , such) know how use basic sockets, , connect client/server... i've wrote client in past, gets ip & port, , connects it, , send images , such using sockets betwen client & server... i've searched internet bit, , found can connect website, , send request, http content of page , store in variable, though have few problems : 1) i'm trying html of page isnt main page of site, like, not stackoverflow.com, stackoverflow.com/help , such (not "official page of site", inside site) 2) i'm not sure how either send or store data got request... i saw there outside libraries use, rather use sockets only... by way - i'm using windows 7, , aim it'll work on windows only(so it's fine if wont work linux) thanks you'r help! :) to access resource on host specify path resource in first line of request, after 'get'. e.g. check http://www.jmarshall.com/easy/http/#http1.1 g

node.js - LESS modifyVars in nodejs -

i'm trying create 1 less stylesheet, multiple css file, different names according variable value. less modifyvars function seems run in browser enviroment. so, possible use less modifyvars function in nodejs? you're right, modifyvars available in browser.js loaded (as name suggests) in browser. with node, can achieve same result prepending string containing variables wish modify. here short example: var less = require('less'); var css = '.class { color: @color };'; ['red', 'blue', 'yellow'].foreach(function(color, index){ var settings = '@color: ' + color + ';'; less.render(settings + css, function (e, css) { console.log('script ' + index + ':') console.log(css); console.log('----') }); }); this should give same results modifyvars .

asp.net mvc 4 - Creating a custom role principal to be used with custom role provider, How do I get IIdentity to pass as parameter? -

i have custom role provider mvc4 application working in creates roles, checks role existence, check isuserinrole [authorize(roles = "admin")] still using default system.web.security.roleprincipal.isinrole(string role) method i have tried create custom roleprincipal overrides isinrole method having problem finding correct parameter constructor , unsure how set in web.config. code follows: using system; using system.collections.generic; using system.linq; using system.web; using system.configuration.provider; using metalearning.data; using system.web.security; namespace project.principal { public class myprincipal : system.web.security.roleprincipal { private mycontext dbcontext = new mycontext(system.configuration.configurationmanager.connectionstrings["mycontext"].connectionstring); private repository<myuser> userrepository; private repository<role> rolerepository; public myprincipal() { this.userreposito

java - Querying associate table with HQL -

i have 2 entity class onetomany relationship: @entity @xmlrootelement @dynamicinsert (value = true) @dynamicupdate (value = true) public class matchs { @id @generatedvalue private long matchid; private int size; @onetomany(fetch = fetchtype.lazy) @jointable(name = "match_users",joincolumns=@joincolumn(name="match_id"), inversejoincolumns=@joincolumn(name="user_id")) private list<user> users; //getters & setters } @entity @xmlrootelement @dynamicinsert (value = true) @dynamicupdate (value = true) public class user { @id private string username; private string lastname,firstname,password,email; private date dateofbirth; //getters & setters } i want matchs particular user.this query: matchs user.username=:username this query throws org.hibernate.queryexception. how can accomplish hql. you seems fetching data on column not exist in matchs table. don't see colum

Display Partial in Modal with Foundation and Rails -

i trying create thought simple modal login window in rails using foundation. unfortunately isn't easy thought. basically trying provide link user on main page when click, display devise signup form in modal window. can me out? thanks! here example of how foundation <%= link_to "sign up", '#', data: {:'reveal-id' => 'signupmodal'} %> <div id="signupmodal" class="reveal-modal"> <%= render 'devise/registrations/new' %> <a class="close-reveal-modal">&#215;</a> </div> you have rename devise/registrations/new devise/registrations/_new make partial. you can find full set of options , documentation in foundation docs on reveal

PHP mysql bug query -

hi guys i've been working straight 12 hours, can't seem find fix. i'm trying compare user-input database result example $username == $result echo "username aldready taken, problem it's passing through 2 statements without break, , if put break exit loop, check $email == $result2 despite of not entering email in field. if (isset($_post['username']) or isset($_post['email'])) { $extract = mysql_query(" select `username`, `email` `users` `username`='$username' or `email`='$email' "); $resultq = mysql_num_rows($extract); while ($row = mysql_fetch_array($extract)) { $result = $row['username']; $result2 = $row['email']; echo " " . $result; echo " " . $result2; if ($username == $result) { echo " username taken!"; // break; //whenever put break, gives me else if

c++ - dynamic memory management scenario -

should 1 use dynamic memory allocation when 1 knows variable not needed before goes out of scope? for example in following function: void func(){ int =56; //do i, not needed past point for(int t; t<1000000; t++){ //code } } say 1 needed small section of function, worthwhile deleting not needed in long loop? as borgleader said: a) micro (and premature) optimization, meaning don't worry it. b) in particular case, dynamically allocation might hurt performance. tl;dr; profile first, optimize later as example, compiled following 2 programs assembly (using g++ -s flag no optimisation enabled). creating i on stack: int main(void) { int = 56; += 5; for(int t = 0; t<1000; t++) {} return 0; } dynamically: int main(void) { int* = new int(56); *i += 5; delete i; for(int t = 0; t<1000; t++) {} return 0; } the first program compiled to: movl $56, -8(%rbp) # store 56 on stack (int = 56

autotools - Automake: variable not expanded on Solaris -

i have variable declared in configure.ac: my_version="0:0:0" ac_subst(my_version) ac_msg_notice([$my_version]) the value of variable printed out correctly during ./configure phase. in makefile.am there's following line: libmylib_la_ldflags = -version-info @my_version@ in linker command line expands correctly "-version-info 0:0:0" on systems except solaris. on solaris (sunos 5.10 generic_141414-10 sun4u sparc sunw,sun-blade-100) "-version-info" no version number. any idea may have gone wrong? (a bit of shot in dark here, but…) my guess either or version defined on solaris whatever reason. try usign ac_subst([my_version]) instead, way you're telling m4 explicitly define that. also igor said, use $(my_version) (although unrelated this.)

class - How to handle external sub prototype with local AUTOLOAD in Perl -

i'm having issue following scenario. i'm writting class uses autoload somtimes call functions module (not mine). other module use few functions prototypes defined. 1 example this: sub external_sub (\@$) { ... } those functions work correctly when imported directly module, calls following: my @arr = (1..10); external_sub(@arr, 'something else'); now, problem have when requiring external module class @ run time , importing function, can't find way pass right arguments it. inside autoload function, count on @_ only, , don't know if there's way in perl tell apart array passed first argument autoload . so, inside autoload , options can think far redirect call are: no strict 'refs'; $sym = *{"externalmodule\::$called_sub"}; *$autoload = $sym; goto &$autoload; ...or like: no strict 'refs'; return &{"externalmodule\::$called_sub"}(@_); or several similar things using symbol table. however, problem