Posts

Showing posts from July, 2013

java - Why the data retrieved isn't shown -

i retrieve data http://api.eventful.com/rest/events/search?app_key=42t54cx7rbrdfczc&location=singapore . tag under "title", "start_time", "longitude", "latitude". not sure why couldn't display out after added longitude , latitude. this logcat: 08-07 17:17:44.190: e/androidruntime(23734): fatal exception: main 08-07 17:17:44.190: e/androidruntime(23734): java.lang.nullpointerexception 08-07 17:17:44.190: e/androidruntime(23734): @ com.example.eventfulmaptry.mainactivity$itemadapter.getview(mainactivity.java:147) 08-07 17:17:44.190: e/androidruntime(23734): @ android.widget.abslistview.obtainview(abslistview.java:1618) 08-07 17:17:44.190: e/androidruntime(23734): @ android.widget.listview.measureheightofchildren(listview.java:1241) 08-07 17:17:44.190: e/androidruntime(23734): @ android.widget.listview.onmeasure(listview.java:1152) 08-07 17:17:44.190: e/androidruntime(23734): @ android.view.view.measure(view.java:8513...

javascript - Use jQuery to make div value go up or down where $(this) is used -

i have pretty script allows user "thumb up" comment. script uses jquery make "thumb up" image green when user clicks it. user can also"un-thumb up" comment clicking image again, , image go green white. lastly, there little div displays number of people have "thumbed up" particular comment. this question comes in. of right now, little div total number of thumb-ups comment not refreshed when user clicks or un-clicks "thumb-up." number changes if user refreshes page. div automatically go 1 integer if user thumbing comment (i.e. making image turn green) , go down 1 integer if user un-thumbing (i.e. turning image go green white). the "little div" total number of thumb-ups called expressed (you can see full use in second block of code): <div class='upvote_count'>$total_upvotes</div> i having trouble because jquery uses "$(this)" , don't know how refer element... ideas on how make happen ...

jQuery column equal height issue -

i'm trying display 2 divs height set 3rd of body width , match these height if divs require more space match 1 aother. equal height columns. here have far: var width = $('body').width(); var thirtyheight = width /10*3 $('.thirtyheight').css('height',thirtyheight); this gets width , sets height perfectly, i've tried using equal height snippets nothing yet has worked. if has suggestions i'd love hear them. check this $('.thirtyheight').css({'height',thirtyheight+'px'});

php - Combined conditions in CI ActiveRecord -

i want sql query like select * x = 10 , (y=12 or h=15) how can achieve in ci activerecord format? see active record reference $where="x = 10 , (y=12 or h=15)"; $this->db->select('*'); $this->db->from('mytable'); $this->db->where($where); $query = $this->db->get();

windows - Script to delete one alphabet from XML file -

i delete 1 symbol "&" hundred xml file's regularly. instead of doing manual work, want write .bat script , schedule it. when bat script runs, & symbol xml files has deleted script. we have location d:\transfer\, in location application generate xml files regularly. want search symbol (&) in 1 line of xml , delete & symbol xml. can please me out this? try this: @echo off &setlocal set "search=&" set "replace=" %%a in ("d:\transfer\*.html") call:process "%%~a" goto:eof :process set "textfile=%~1" set "newfile=%~1.new" (for /f "delims=" %%i in ('findstr /n "^" "%textfile%"') ( set "line=%%i" setlocal enabledelayedexpansion set "line=!line:%search%=%replace%!" echo(!line! endlocal ))>"%newfile%" goto:eof you can use sed this: for %%a in (*.html) sed "y/&/ /" ...

How can I install python or python packages with a specific PyUnicode? -

i trying install pyfftw pythonic wrapper fftw . when following error. importerror: /usr/local/lib/python2.7/dist-packages/numpy/core/multiarray.so : undefined symbol : pyunicodeucs2_fromunicode vaarious websites suggest when problem occurs either install python correct pyunicode or install python package correct pyunicode. have no idea how either of these. can please provide me step-by-step guide on how this? i installing pyfftw package using sudo pip install pyfftw on raspberrypi. thanks, e.lee

ibm mobilefirst - Dojo. Different colors in Device than in preview -

i'm using wl 5.0.6 i create new hybrid application dojo. i create edgetoedgelist 2 listitem. when preview it, list items , background grey when run application in android device list items , background black. how can change behaviour? thank you. if want use theme see in preview on android, remove: <script type="text/javascript" src="dojox/mobile/devicetheme.js"></script> from main html. going want add like: <link rel="stylesheet" href="dojox/mobile/themes/iphone/iphone.css">

asp.net mvc 3 - MVC 3 Global.asax Redirect request -

i have ssl certificate example.com domain. want make redirection if user wants enter site www.example.com . code below works fine, can't enter site if want use https://www.example.com in url bar. why ? protected void application_beginrequest(object sender, eventargs e) { if (request.url.host.startswith("www", stringcomparison.invariantcultureignorecase)) { response.clear(); response.addheader("location", string.format("{0}://{1}{2}", request.url.scheme, request.url.host.substring(4), request.url.pathandquery) ); response.statuscode = 301; response.end(); } } i guess there no binding on web server listening https://www.example.com . have valid certificate https://example.com . when attempt request https://www.example.com iis drops conne...

objective c - NSString returns empty with WebView Innerhtml -

i'm not hero objective-c please bare me i'm learning grips. although have great knowledge javascript, mac osx development seems hard. i'm creating app relies on html5 , goal 'simply' save contents of specific div running javascript function. i've been searching everywhere , cannot seem find example me further or getting started. i'm hoping guys me point towards right direction. ben taylor on twitter gave me starting code. nsstring *html = [yourwebview stringbyevaluatingjavascriptfromstring:@"document.getelementbyid('nssidebar').innerhtml"]; nslog(@"contents:%@",html); the log returns empty. may because webview has not been loaded in order have string find 'some-element' div. current code be: - (void)applicationdidfinishlaunching:()mywebview { nsstring* filepath = [[nsbundle mainbundle] pathforresource:@"index" oftype:@"html" ...

html5 - iFrame error on youTube video insert with video.js player -

i use video.js vjs.youtube.js plugin play youtube videos within video.js player on site. works quite fine , videos can added page dynamically. but problem happens whenever try add multiple youtube videos. problem chrome throws out following error: blocked frame origin " http://www.youtube.com " accessing frame origin " http://mysite.local ". protocols, domains, , ports must match. does know how solve problem? greetings it works online, in local doesn't.

matlab - Find Value at a given Orientation in Matrix -

in matlab i've matrix where, in previous stage of code, specific element chosen. point of matrix find maximum, not maximum value between surounding neighbours given radius, maximum value @ given angle of orientation . let me explain example: this matrix a: a = 0 1 1 1 0 0 9 1 0 0 2 2 4 3 2 8 1 0 0 2 2 3 3 2 2 1 0 0 1 1 3 2 2 2 1 0 0 8 2 3 3 2 7 2 1 0 1 1 2 3 2 3 2 1 the element chosen in first stage 4 in a(2,4), , next element should maximum value with, example, 315 degrees angle of orientation, 7 in a(5,7). what i've done is, depending on angle, subdivide matrix in different quadrants , make new matrix (an a's submatrix) values of quadrant. so, example, submatrix a's 4th quadrant: q_a = 4 3 2 8 1 0 ...

Dynamic control creation using Knockout.js -

i developing application reads xml file , xml file has info type of controls rendered on browser textbox,combo etc. planning implement same using knockout.js. best possible view model design implement same. consider xml file as: <controls> <parentelement> <attr id="1" visibilty="t" type="combobox"></attr> <attr id="2" visibilty="n" type="combobox"></attr> </parentelement> <childelement dependson="1"> <attr id="3" visibilty="t" type="textbox" value="abc"></attr> <attr id="4" visibilty="t" type="combobox" value="xyz"></attr> </childelement> <childelement dependson="2"> <attr id="5" visibilty="t" type="textbox" value="def"></attr> <attr id="6" visibilty="t" type=...

c# - Read .xml file on windows phone -

i add .xml file roject. need open it. try filestream, streamreader, isolatedstoragefilestream. there exception in each case. know how can open local xml file , data it? public static allflags load() { isolatedstoragefile storage = isolatedstoragefile.getuserstoreforapplication(); allflags allflags; isolatedstoragefilestream stream = storage.openfile(filename, filemode.open); //streamreader stream = new streamreader(filename); xmlserializer xml = new xmlserializer(typeof(allflags)); allflags = xml.deserialize(stream) allflags; stream.close(); stream.dispose(); return allflags; } if not need xml specific information, read contents of file easiest way: http://msdn.microsoft.com/en-us/library/system.io.file.readalltext.aspx system.io.file.readalltext(@"drive:\path\to\your\file.xml"); otherwise there speficied xml objects in framework so. typically use xmldocument . see example...

html5 - webm video wont run with wordpress -

i have manually uploaded webm video server on wp-content/uploads/2013/08 directory. can't upload wordpress library because wordpress tells me there security problem. then insert video.js short code post, , give url like: " http://ecole-dupuis.ch/wp-content/uploads/2013/08/nameofthevideo.webm ". unfortunately, when preview post, video player shows, no video in it. thanks in advance help. put below entry in .htaccess addtype video/webm .webm

c# - How do I highlight a certain word in a label? -

i have been watching couple of videos , i've noticed can highlight or set backcolor every word finds in richtextbox, tried doing label i'm working on project can't use label.find , label.selectionbackcolor etc. there way search word in label , highlight it? here workaround, create richtextbox , use label. set these properties make label: richtextbox.readonly = true; richtextbox.borderstyle = borderstyle.none; richtextbox.backcolor = systemcolors.control; // or whatever background color work around disable user selection: richtextbox.enabled = false; richtextbox.selectall(); richtextbox.selectioncolor = systemcolors.controltext; // or whatever want default text color // have set color or else gray because of enabled=false edit: tried it, after selectall(); , selectioncolor = systemcolors.controltext changing or adding of text keeps black (unless current selectionstart @ point of text color different

Getting IP addresses for hostnames using nslookup in Powershell -

i new powershell scripting , need write 1 script. have list of server hostnames , need ip addresses of servers , write results in file. the hostnames 1 column in excel spreadsheet can format them (csv, simple txt file 1 hostname per line etc.). i format output way there hostname of server , ip address per line (so there multiple lines in case server has more 1 ip). so far have been using simple text file hostname per line, output in ps unable distinguish server ip address for. $servers = get-content "path_to_the_file" foreach ($server in $servers) { [system.net.dns]::gethostaddresses($server) } so wondering loading hostnames csv file , printing hostnames , related ip addresses csv again, unsure how. i investigating possibility capture required information (hostname , ip) running nslookup $server in foreach. could give me hand? thank you. combining hostnames addresses can done within loop. host can have multiple ip addresses, need take accout too....

clojure - Why do agents have a pool of threads? -

in clojure documentation see agent use pool of thread process data. read (always in documentation) : the actions of agents interleaved amongst threads in thread pool. @ point in time, @ 1 action each agent being executed. why agent have pool of thread , not single thread process "queue" of sended function ? thanks. an agent not 'have pool of threads'. there 2 thread pools (for send , send-off actions), agent actions assigned. this design decision optimal choice cpu-bound tasks, , best-effort approach io-bound tasks. for latter case, providing own pool send-via optimal choice (assuming know you're doing).

android - How to get _ID with SimpleCursorAdapter -

so far got this db = new mydbhelper(this); constantscursor = db.getreadabledatabase().rawquery( "select _id, title, value " + "from constants order title", null); listadapter adapter = new simplecursoradapter(this, r.layout.item, constantscursor, new string[] { dbhelpermen2.title, dbhelpermen2.value }, new int[] {r.id.item_name, r.id.item_points }); listata = (listview) findviewbyid(r.id.listview1); listata.setadapter(adapter); but have 1 more field named item_number. field want write _id number how can ? new simplecursoradapter(this, r.layout.item, constantscursor, new string[] { **???** ,mydbhelper.title, mydbhelper.value }, new int[] {**r.id.item_number** , r.id.item_name, r.id.item_points }); here mydbhelper public class mydbhelper extends sqliteopenhelper { private static final string database_name = "db"; static final string title = "title"; static final string value = "value"; pu...

jquery - <ul> sub item count issue -

below code generated dynamically (between <li> </li> ) , removed. <div class="popup-content"> <ul id="ulpopup" class="share-items-list"> <li> <div class="item-container"> <a href="#" class="close"></a> <span class="icon icon-kind-file icon-kind-pdf">pdf</span> <span class="item-title">notes last meeting</span> <a href="#" class="link-icon link-secondary icon-info-sign icon-medium"></a> </div> </li> <li> <div class="item-container"> <a href="#" class="close"></a> <span class="icon icon-kind-file icon-kind-doc">doc</span> <span class=...

Jersey + Embedded Tomcat Minimal Maven Configuration -

could provide simple configuration of jersey , embedded tomcat in: 1) pom.xml 2) main method i trying find in google search, propose use grizzly, glassfish , etc. thanks lot. i go webapp-runner run web app. deploys maven generated war /target built in tomcat container. how java applications gets deployed on heroku. pom plugin configuration: <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-dependency-plugin</artifactid> <version>2.4</version> <executions> <execution> <phase>package</phase> <goals> <goal>copy</goal> </goals> <configuration> <artifactitems> <artifactitem> <groupid...

scala - Change 'play dist' output file name via command-line -

is possible change play dist output file name apart modifying appname on build.scala ? i'm trying automate creation of 2 different zip files same project tree, e.g.: myapp-production-1.0-snapshot.zip , myapp-integration-1.0-snapshot.zip . thank much! for play framework 2.4 changing name of output file worked in build.sbt: packagename in universal := "dist"

c# - Unhandled exception thrown by PhotoChooserTask -

i've got code , i'm using show button allows user choose image library , use background app. so create photochoosertask , set show camera , bind method has executed when task completed. button start task showing photochoosertask . action on complete quite easy, i've got set boolean value , update image source. photochoosertask pct_edit = new photochoosertask(); pct_edit.showcamera = true; pct_edit.completed += pct_edit_completed; button changeimagebutton = new button { content = "change image" }; changeimagebutton.tap += (s, e) => { pct_edit.show(); }; void pct_edit_completed(object sender, photoresult e) { if (e.taskresult == taskresult.ok) { bi.setsource(e.chosenphoto); isrebuildneeded = true; } } the problem won't show photochoosertask give me exception, taking me private void application_unhandledexception(object sender, applicationunhandledexceptioneventargs e) { if ...

ios - ARC Not Release View Controller Variable -

i got following variable in view controller's @private section, arc seam release want stay , not collected.. how? nsmutablearray* carpictures; thanks there's not enough information answer question. try declaring strong property ie @property (nonatomic,strong) nsmutablearray *carpictures; and set variable self.carpictures = [nsmutablearray array];

javascript - TinyMCE 4 - get caret position -

i want caret position in tiny mce 4, don't want row/column number - want position in pixels (x & y dimmension). can relative anything. last thing - want without creating additional tags in content, bookmarks. tinymce have method that? or there option bookmark position in pixels, , after removing it? thanks replies ok, found it. first have instance of tinymce.editor class var editor = new tinymce.editor(); //or way, tinymce.activeeditor next jquery position of tinymce widgets: var tinymceposition = $(editor.getcontainer()).position(); var toolbarposition = $(editor.getcontainer()).find(".mce-toolbar").first(); now position of html node, you're edit: var nodeposition = $(editor.selection.getnode()).position(); var textareatop = 0; var textarealeft = 0; we have y-axis position (via nodeposition.top ), it's time x: if (editor.selection.getrng().getclientrects().length > 0) { textareatop = editor.selection.getrng().getclientrects...

java - How to handle Mazovia encoded text -

im using java edit text files containing records. files handled old systems probably use mazovia ( wiki ) encoding. cant find way handle files , it's beginning give me headache. when edit text files java code, systems find additional characters in them, breaking entire record structure (character position matters). how edit files without introducing additional characters/breaking encoding? proper display of characters great, if it's not possible, i'll make not breaking record structure. if use example iso-8859-1 when reading , writing not break file since every byte maps character , every character maps single byte. (any encoding these characteristics do.) you won't correct unicode characters when reading (for have implement custom charset , i'm not sure how work is), @ least won't break file.

escaping - Unescape apostrophe (&#39;) in JavaScript? -

i'm trying unescape html-escaped apostrophe ( "&#39;" ) in javascript, following doesn't seem work on devtools console line: unescape('&#39;'); the output simply: "&#39;" it doesn't work in underscore's unescape either: _.unescape('&#39;') what doing wrong? unescape has nothing html character entities. it's old, deprecated function decoding text encoded escape , old, deprecated function encoding text in way unlikely useful in modern world. :-) if need turn html plain text, easiest way via element: var div = document.createelement('div'); div.innerhtml = "&#39;"; alert(div.firstchild.nodevalue); live example | live source note above relies on fact there no elements defined in html text, knows there 1 child node of div , text node. for more complicated use cases, might use div.innertext (if has one) or div.textcontent : var div = document.createelement(...

visual studio 2012 - Debugging Smart Card Minidriver -

i'm working on cng smart card minidriver. to test functionality i'd use makecert import private key smart card. unfortunately every change make have copy minidriver.dll system32 directory. once called makecert first time, minidriver.dll in use, , can't overwrite unless reboot pc (which takes time..) is there way overwrite without rebooting? my second attempt debug using visual studio , starting makecert visual studio. prompted with: the breakpoint not hit. no symbols have been loaded document. is there way debug minidriver.dll within visual studio using makecert.exe ? thanks help.

c# - How use font forge to generate a font in cmd -

prompt please how convert ttf svg in utility fontforge command line windows, or how use api in .net, creating script these 2 function calls : open($1,1) generate($2) and running this: fontforge -script script.pe input.ttf output.svg should want.

8 digit web color in xml -

i found color definition in xml file looks #8867d1fd . wanted check in e.g. photoshop color picker keeps cutting 2 last digits. kind of notation it? colors defined 6 digits (red , green , blue components of color) , 2 digits alpha degree of transparency. useful if want show content , background well. 0 alpha means transparent, ff means solid , background not shown. number in between means semi-transparent or semi-solid. so format is: argb ( alpha , red , green , blue ) to check color use #67d1fd check color without alpha.

Ext: how can I use data from an ajax request to modify an existing Javascript element? -

for days i've been searching explanation on how right. tried find decent tutorial either js or ajax, one's found rather basic , didn't go deep enough. when want solve problem python, go python.org, php use php.net, haven't found decent ressource js , ajax yet. tips appreciated. so i'll try explain did. have rather simple page, has div on left , div on right. within left one, tree rendered, representing registry, within right one, values displayed , edited. the tree stored in global variable. have read warnings using global variables, think it's justified in case. whenever page accessed, tree displayed. var tree; ... function inittree(treerootconfig) { return new ext.tree.treepanel({ renderto : 'tree' ,width : 500 ,height : 498 ,autoscroll : true ,resizable : true ,usearrows : false ,animate : true ,loader : { dataurl : urls.urlloadtree, ...

error handling - In C++, how can I get the current thread's call stack? -

i'm writing error handler code i'm working in, in c++. able make sort of reference whatever have on stack, without being explicitly passed me. specifically, let's want print names of functions on call stack, in order. trivial in managed runtime environments jvm, not trivial 'simple' compiled code. can this? notes: assume simplicity compile code debugging information , no optimization. i want write either platform-independent or multi-platform. prefer former. if think i'm trying reinvent wheel, link source of relevant wheel , i'll there. update: i can't believe how need bend on backwards this... makes me pine language shall not mentioned. there way back-trace in c++, though not portable. cannot speak windows, on unix-like systems there backtrace api consists of following functions: int backtrace(void** array, int size); char** backtrace_symbols(void* const* array, int size); void backtrace_symbols_fd(void* const* array, int...

Email Notification System Using PHP MySQL -

i working on project requires sending email notifications users. way works, users follow catergories of posts/group, whenever there new post or comment under post category/group email message notifying them snippet of post itself. i expecting send upwards of 5000 emails daily. effective use cron job fetch users , send emails @ intervals or there better means push email while avoiding blacklisting on ip email providers. below table structure first table notification id // autoincrement message // message sent users createdate // date created second table user_notification id // auto increment userid // id of users notification_id // id of notification first table status // 0 or 1 so whenever post added, insert notification in first table (notification) , fetch followers of group table (following) store userids , group ids. insert each user in second table (user_notification). my cron job fetchs 20 records user_notification table , fetch notification message notifica...

Returning Rows from Search in Excel -

Image
i have hard time explaining things apologize in advance if things, or everything, doesn't make sense. okay, here's dilemma. have spreadsheet couple columns (shown here separated "|"): time | user | bytes sent | server id the data in sheet collected @ irregular intervals. script gets data samples cumulative amount of bytes sent "user" "server id" , puts in time sampled, goes next row. the values sorted according time. need calculate average bitrate based on time sample received , number of bytes sent. difficult part calculation should done on rows match "id" , "server" user searches for. on top of that, has automated because i'm making tech support people who, me, have limited knowledge in excel. what thinking doing searching through sheet , putting rows have matches different sheet, simple calculation on sheet average bitrate. question is, how extract rows? ok here how in excel 2007/2010. i did in tabl...

report - ODS EXCEL.TAGSET title statement -

i print text before show result of proc report. ods excel.tagset. title statement. title statement limited 10 titles (title1 title2,...). need more 10 textlines @ output. how can this? have sas9.2. edit: here code example: ods tagsets.excelxp style=sasdocprinter file=_webout options(embedded_titles='yes' embedded_footnotes='yes'); title1 'title text row1'; title2 'title text row2'; ... title10 "title text &macro_var."; footnote1 'footnote text'; proc report data=lib.a; ... run; given using proc report , easiest way around may have proc report handle lines of text. in proc report , have option of doing compute before _page_ , execute prior each time page begun - suspiciously title. proc report nowd data=sashelp.class; columns sex name age height; define sex/group; define name/display; define age /display; define height/display; compute before _page_; line "title row 11"; line "title row 1...

html - CSS table affecting my Navigation bar which is also a table -

my problem i'm trying create table in css without affecting navigation bar has been created table in fireworks. i've tried targeting table using id , class selectors didn't work. this table want create in css : .cart table { border-collapse: collapse; color: #999; font: 80%/1.2 'arvo', serif, sans-serif, georgia, "times new roman", times,serif; font-weight: normal; } .cart table th, td { border-right: 1px solid #fff; border-bottom: 1px solid #999; padding: .5em; } .cart table tr { background: #b0c4d7; } .cart table thead th { background: #fff; color: #fff; } .cart table th { font-weight: normal; background: #fff; } .cart table tr.alternate { background: #fff; } .cart table tr.alternate th { background: #fff; } the html code: <div class="cart"> <table> ............ info here etc............. </table> </div> the navigation bar css is:...

Multiple Global Variables in Javascript -

this isn't specific problem, more theoretical question. there ever reason expose multiple global variables for single javascript application ? i can see using, , use myself, single global variable name object or class containing app can recalled multiple times (example below), can't think of case when additional global variables couldn't replaced object properties. example exposed variable makes life easier (using closure, couldn't recalled): var myglobalapp = { init: function (args) {...}, methodone: function () {...}, methodtwo: function () {...}, propertyone: 'string example' }; myglobalapp.init(arg1); myglobalapp.init(arg2); does know of instance case multiple global variables necessary? i don't think it's ever strictly necessary have multiple globals - javascript objects can arbitrarily nested, , can used namespaces. window.awesomemodule = { app: { ... }, util: { ... } }; in ...

java - Which thread runs all the AWT/swing event handling code? -

i new java , there interview question graduate role didn't understand, can tell me thread , purpose please. swing ui toolkit single threaded (in sense unsafe call of swing libraries other thread). ui events, both rendering , dispatching them done edt thread . so on clicking @ button on desktop. os gives notification edt receives event , triggers callback function registered button click. code, when action (for ex: repaint screen or draw image). edt delivers change os , rendered on screen. hence 2-way interaction. because mentioned swing ui toolkit single-threaded. hence advisable call of swing libraries edt usign system.invokelater. more info here .

java - Mongodb / Jongo sorting then limit, vs, limit then sorting -

are these 2 guaranteed same: collection.limit(10).sort("{score: -1}") vs collection.sort("{score: -1}").limit(10) the second 1 global sort, , returns top 10. first 1 guaranteed same, or may return 10 sorted records? thanks in normal queries, sort processed first, skip , , limit , no matter in order add them cursor object. the aggregation framework execute $sort , $skip , limit operators in order of appearance in pipeline.

C# variables, methods, reference exercise -

i have made exercise on c#, here is: class program { static double funk(int a, ref int b) { double c = + b; = 5; b = * 3; return c; } static void main(string[] args) { int = 1, b = 2; console.writeline(funk(a, ref b)); console.writeline(a); console.writeline(b); console.readline(); } so, result pretty clear when run code, gives me: 3 1 15 my question is, did 15 , 3 came from? the 3 came from: double c = + b; //... return c; this gets printed out console via first writeline . the 15 comes from: double c = + b; // c == 3 = 5; b = * 3; // b == 5 * 3 == 15 since pass in b ref , you're changing actual value of caller variable ( b in main ), gets set 15, printed out third writeline .

javascript - How to assign a variable type to variables in an object -

this question has answer here: unexpected output in javascript 5 answers here code var m = new object(); m.p1 = 37.7; m.p2 = 37.7; ... function addsubtract(pn){ switch (pn) { case 1: var amt = prompt("enter value"); if (amt != null) { m.p1 += amt; } break; } } basically when enter 1, value of m.p1 becomes 37.71 instead of 38.7 then enter 1.0 , shows 37.711.0. figured out doing concatenation rather addition. tried find way declare type can't figure out how use in variable in object. i more of c++ person , there obvious i'm missing here. can't find on google. so have assign type or there way force arithmetic addition? the result of prompt() string. if add number string, number converted string , concatenation performed. to convert string float use 1 of following: var am...

c# - asp.net stored procedure insert multiple pairs of data into the DB -

i have method accepts int[] (userids) , int (groupid) parameters. runs stored procedure , insert data db for example: if userids=[1,2,3] , groupid=4, want following data inserted db userid groupid 1 4 2 4 3 4 i have 2 solutions problem. first 1 write stored procedure insert single record db. in method(), loop through int[] , call stored procedures n times method() (int =0; i< userid.length; i++){ // call stored procedure insert single record } the second solution pass int[] , int parameters stored procedures , looping in stored procedure. which way better solution? ( if 2nd solution better, can provide guidance on handling int[] in stored procedure ) is there reason why don't want use o/r mapper? example looks server / code-behind , can use entity framework (or other) insert new values. if can't use them use ( 2nd in posting) approach. it's dangerous, because not within transaction. you can start entit...

configure maven site plugin for multi generational projects -

i have company pom, aggregator parent pom, , children. company pom has distributionmanagement url allows deploy site. however, when aggregator , children inherit it, creating incorrect paths. example: api-docs/company-pom/1.4-snapshot/../../procject-webservice/2.0/procject-parent/procject-webservice what right way configure company pom, , aggregator, end this: api-docs/company-pom/1.4-snapshot/ api-docs/procject-parent/2.0/ api-docs/procject-webservice/2.0/ (no, company pom not deploying @ same time project)

haskell - Typeably casting GADTs -

let's i'm writing dsl , want have support both phantom type support , badly typed expressions. value types might be {-# language gadts, datakinds #-} data ty = num | bool deriving (typeable) data val vnum :: int -> val num vbool :: bool -> val bool and can work phantom erased version {-# language existentialquantification #-} data valunk = forall . valunk (v' a) now, can operate on values of valunk case ing out both vnum , vbool , reestablish phantom types in way getnum :: valunk -> maybe (val num) getnum (valunk n@(vnum _)) = n getnum _ = nothing but feels i'm reimplementing typeable machinery. unfortunately, ghc won't let me derive typeable val src/types/core.hs:97:13: can't make derived instance of `typeable (val a)': val must have arguments of kind `*' in data declaration val is there way around restriction? i'd love write getit :: typeable => valunk -> maybe (val ...

asp.net - asp:treeView hiding the /- button? -

i have treeview in app i'm making. changed parent nodes expand when clicked using selectaction propery, i'd remove +/- expansion button. tried setting navtree.showexpandcollapse = false; disabled expansion ability of parent nodes. does how remove +/- button without messing node's select action event? thanks here's cs protected void page_load(object sender, eventargs e) { service1 myservice = new service1(); // //populate site menu gridview sites = new gridview(); sites.datasource = myservice.getallsites(); sites.databind(); foreach (gridviewrow siterow in sites.rows) { treenode parentnode = new treenode(siterow.cells[1].text); parentnode.selectaction = treenodeselectaction.expand; parentnode.collapse(); navtree.nodes.add(parentnode); treenode childnode = new treenode(siterow.cells[2].text); childnode.navigateurl = "http:...

php - Save Indexed Array -

i trying figure out how save indexed array field in database. said, know array can't saved database, can serialize or implode , save. im not sure 1 should using though. don't want collection of items saved in 1 cell. need list of items saved 1 one in column. question need using serialize method, implode or else? here glimpse of code , array trying save. public function findpolicyids($coverageid = null) { $policyid = $this->policy->find('all', array( 'recursive' => -1, 'conditions' => array('policy.coverage_id' => $coverageid), 'fields' => array('policy.id'))); foreach($policyid $id) { $all[] = $id['policy']['id']; } return $all; } array ( [0] => 5202834f-111c-4a76-8b33-1ed8ae78509d [1] => 5202834f-2ba8-4957-91db-1ed8ae78509d [2] => 5202834f-356c-49a1-beeb-1ed8ae78509d [3] => 5202834f-3b40-453f-a491-1ed8ae785...

sqlite - What is the "best practice" way to keep a database reference in an Android app? -

i'm using common database of app (which consists of multiple activities , multiple fragments). imagine pretty standard, i'm asking more general question. "best" way (and why) keep track of database? i planning on using static variable in helper class (as limited understanding of activity lifecycle means main activity can nuked later, that's not safe place leave it). option use asynctask database reference "fresh" every time need (which how i'm doing first time). don't think can send using extras , don't know of tricks make serializeable. are there other options i'm missing? i've seen references using application, i'm not familiar those. i planning on using static variable in helper class that, or contentprovider wrapper around database, 2 typical approaches. as limited understanding of activity lifecycle means main activity can nuked later, that's not safe place leave it moreover, since ha...

apache - Parse CSS file as PHP -

so, moved new host. using code in htaccess parse css files php. in new host, didn't work. googled , googled , tried every code find. single of them didn't work. here's of codes i've tried: addhandler application/x-httpd-php .css addhandler application/x-httpd-php5 .css addhandler application/x-httpd-php53 .css addtype application/x-httpd-php .css my php version 5.3.22 , webhost using linux. didn't work. please help. from parse js/css php file using htaccess you should need add htaccess <filesmatch "\.css$"> sethandler application/x-httpd-php header set content-type "text/css" </filesmatch> if you're getting 500 internal server error header line, make sure have mod_headers enabled in apache config, if mod_headers not installed , provider not install/enable it, need rename css file .php , add new php file header("content-type: text/css");

linux - c++ timer implemetation - Assigning a member function to signal callback function pointer -

hi have been tryng implement timer using posix timer libs, making mistake in implemetation, using example web , tryng encapsulating in class but, compiler doesnt it, tryng asign callback function int sigev.sigev_notify_function = timer0_irqhandler; cannot result. here goes code: the class definition: #include <sys/time.h> #include <pthread.h> #include <signal.h> #include <time.h> #include <stdlib.h> #include <stdio.h> //se agrego para eliminar el siguiente warning del compilador //warning: incompatible implicit declaration of built-in function 'memset' #include <string.h> /* memset */ #include <unistd.h> /* close */ #define timeval_max 0xffffffff #define timeval unsigned int // timer incrementing every 4 us. //#define ms_to_timeval(ms) (ms * 250) //#define us_to_timeval(us) (us>>2) // timer incrementing every 8 us. #define ms_to_timeval(ms) ((ms) * 125) #define us_to_timeval(us) ((us)>>3) class timer { pu...

Android SQLite Create Multiple Tables Error -

im having weird crash when creating multiple sqlite tables... the code works fine if comment out line execute create_movements_table. the first table created without problem, if try create both, app crashes. the weird thing is: if test app on phone without creating second table, works fine, ... if test again (with app installed), 2 sql statements, (creating both tables), app works... problem occurs when app not present @ in phone import android.content.contentvalues; import android.content.context; import android.database.cursor; import android.database.sqlite.sqlitedatabase; import android.database.sqlite.sqliteopenhelper; import java.util.arraylist; import java.util.list; public class databasehandler extends sqliteopenhelper { private static final int database_version = 1; private static final string database_name = "clientsmanager"; private static final string clients_table = "clients"; private static final string movements_table...

is the notion of a Table required at all in Azure Table service? -

i working azure table services. ask whether azure internals care notion of table @ all? making things fast largely depend on partition key , row key. tables not containers or grouping of entities because there no limit on number of tables can create. total storage size tied storage account. so table notion people transition rdbms land or serve purpose internally? can applications single table design without worrying performance? after all, if table tag may include part of partition key. edit to give example, table partition keys cassandra rows , table rows cassandra columns. okay treat storage big bucket of key(rowkey)-value pairs. partition keys sharding mechanism. table comes across "labeling" notion. you can have entities in single azure table storage , optimum performance thoughtfully choosing right partition key , row key combination, imho time better have related entities each in separate table easy manageable ( developer perspective) . know part o...

c - K&R 2-8 rightrotate (length of integer in bits) -

write function rightrot(x,n) returns value of integer x rotated right n operations i can't see how can bits , put them in right position without requiring length of x(the amount of bits). am thinking wrong or need length of x somehow? if so, how go getting length of x? the code below wrong probaply way, put length_x in demonstrate problem. i hope can point me in right direction. #include <stdio.h> unsigned rightrot(unsigned x, int n); main() { unsigned x = 75; int p, n, y; p = 5; n = 3; y = 45; printf("%u\n",rightrot(x,n)); } unsigned rightrot(unsigned x, int n) { oldn = (x & ~(~0 << n)) << length_x; x = x >> n | oldn; return x; } try: unsigned int rrot(unsigned int x, int n) { int len; (len=31;len>=0 && !((1 << len) & x);len--); len++; return ((x >> n) | (x << (len - n)) & ((1 << len) - 1); } the loop sho...

Formatting numerals and dates in other locales in C#/.NET -

in application i'm writing want display current date , time, in english, in other locales. for example russian, arabic , chinese. // datetime.tolongdatestring doesn't support iformatprovider parameter datetime.now.tostring("dddd, d mmmm, yyyy", new cultureinfo("en-us")); // "wednesday, 7 august, 2013" datetime.now.tostring("dddd, d mmmm, yyyy 'r.'", new cultureinfo("ru-ru")); // "среда, 7 августа, 2013 r." works fine... datetime.now.tostring("dddd٫ d mmm٫ yyyy", new cultureinfo("ar")); // "الأربعاء٬ 30 رمضان٬ 1434" seems work fine. however... i'd show numerals (eastern) arabic numerals, not latin/arabic numerals. though of course solved doing simple substitution ('٠‎' '0', 1 '١' etc). but there's chinese: datetime.now.tostring("yyyy年m月d日dddd", new cultureinfo("zh-cn")) // "2013年8月7日星期三" chinese nu...

c++ - Reducing QListView to the common elements in the list? -

is there methode or simple approach this? given list with: d b b c d d i want list reduced to: a b c d otherwise write process in background. it depends on how data storen , passed view. generally, simpliest way remove duplicates list of element converting set: qstringlist values; //... qset<qstring> set = values.toset(); after can convert set list using tolist or iterate on set using usual foreach loop. note qset unordered. if want sort strings, convert set list , sort list using qsort .

403 forbidden on wordpress index with nginx, the rest of the pages work fine -

i'm setting blog on new ec2 instance because 1 of sites on server that's hosting being ddosed. i'm having trouble nginx, because can either see pages fine 403 on index, or see index 404 on pages (depending on config i'm using) here's nginx config: server { listen 80; server_name www.test.com; server_name test.com; root /www/blog; include conf.d/wordpress/simple.conf; } and simple.conf: location = /favicon.ico { log_not_found off; access_log off; } location = /robots.txt { allow all; log_not_found off; access_log off; } location / { # cool because no php touched static content. # include "?$args" part non-default permalinks doesn't break when using query string try_files $uri $uri/ /index.php?$args; } location ~ \.php$ { #note: should have "cgi.fix_pathinfo = 0;" in p...

c - When uses unsigned data type? -

this question has answer here: signed versus unsigned integers 15 answers when need use unsigned data type , when signed data type in c? , want know why , how decide 1 need. use signed data types when need variable hold negative values. careful overflows, signed integer overflows result in undefined behavior. use unsigned data types when know variable holds non-negative values, or bit patterns. generally, can hold higher maximum value signed data type of equal size. unsigned integer overflows wraparound.

Updated zurb-foundation gem from 4.2.3 to 4.3.1 - Orbit no longer works -

i updated zurb-foundation gem 4.2.3 4.3.1 - orbit no longer works. the dots show , cycle, no images displayed. i need either new version working, or revert previous version worked. <div id="featured"><ul data-orbit> <li><img src="http://placehold.it/1200x500&text=slide image 1" alt="slide image"> <div class="orbit-caption">caption 1</div> </li> <li><img src="http://placehold.it/1200x500&text=slide image 2" alt="slide image"> <div class="orbit-caption">caption 2</div> </li> <li><img src="http://placehold.it/1200x500&text=slide image 3" alt="slide image"> <div class="orbit-caption">caption 3</div> </li> </ul></div> is html code. i'm using default css styl...