Posts

Showing posts from July, 2012

html - Why does IE 8 load the <head> tag below the <body> tag doesn't occur on IE 7 and 9 -

the title explains all. here screenshots i've got on ie8: http://screencast.com/t/sc4xxe8jffu9 ie7: http://screencast.com/t/xeyrczxn3 it's bit weird it's causing lot of css issue on website since precedence not correct. tia edit <!doctype html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <link rel="stylesheet" media="screen" type="text/css" href="<?php echo $this->getthemepath();?>/css/bootstrap.css" /> <!-- <link rel="stylesheet" media="screen" type="text/css" href="<?php echo $this->getthemepath();?>/css/responsive-nav-media.css" /> --> <link rel="stylesheet" media="screen" type="text/css" href="<?php echo $this->getthemepath();?>/css/responsive-nav.css" /> <link rel="stylesh

flex - Installed FB 4.7 but cannot manage to install AIR SDK 3.7 -

Image
i error ios simulator launch requires air sdk 3.4 or higher when try launching mobile app on ios simulator. i did on there website: http://helpx.adobe.com/flash-builder/kb/overlay-air-sdk-flash-builder.html which overwrite airsdk directory new air sdk from: http://www.adobe.com/devnet/air/air-sdk-download.html and long have air 3.6 or higher have ( 3.7 ), need change project's application descriptor right version. i went on , checked forum post it: http://forum.starling-framework.org/topic/flash-builder-47-update-tips here there mention air sdk must not downloaded usual place, 1 used. says install gaming sdk did. installed earlier version 3.6. went other website check versions: http://helpx.adobe.com/air/kb/archived-air-sdk-version.html installed version 3.7 other site , 3.6. same problem on , over.. i missing what? thanks, dave yes, on lay guide wrong in terms of ide gets airsdk (mainly adt command invocation) files from. in order see ide gets have @ la

django - OverflowError: Python int too large to convert to SQLite INTEGER -

i error when run django==1.4.2 tests factory_boy==1.2 in ubuntu 13.04. these tests run in ubuntu 12.10. so changes between them python==2.7.3 , python==2.7.4 . change sqlite version in way? could cause else? full stacktrace: http://pastebin.com/ivkvbz9m

FIFO with 2 clocks in VHDL -

i have problem vhdl assignment. need create fifo buffer between bus of 500mhz , bus of 30mhz. i have designed basic fifo buffer inputs: data_in, write_en, clk_500, read_en, clk_30, flushfifo. outputs: data_out, full, empty. this buffer designed using 2d array: type fifo_arr array (0 63) of std_logic_vector(39 downto 0); signal fifo : fifo_arr := (others => (others => '0')); the problem following: how should write processes , maintain pointer between them synchronization? method have tried, code not synthesize (error:xst:827 signal ptr cannot synthesized) any ideas? thanks , regards it might idea show code complained about! fifos across clock domains tricky, not attempted lightly... having said - looks homework assignment, read can found here: http://eda.ee.nctu.edu.tw/jdhuang/courses/ipcd04/paper/alfke_final.pdf (one of authors late, great, peter alfke - designed first fifo chip, in 1969, , regarded a, or the , fifo-guru)

python - Dictionary of Dictionaries : Sorting by a specific key -

i have dictionary looks this {'africa': {'name': 'africa', 'men': 33333, 'priority': 3, 'women': 30000}, 'america': {'name': 'usa', 'men': 1114444411333l, 'priority': 4, 'women': 44430000}, 'asia': {'name': 'china', 'men': 444433333, 'priority': 2, 'women': 444430000}, 'europe': {'name': 'uk', 'men': 11111333, 'priority': 1, 'women': 1111430000}} i need sort dictionary key = priority i'm using 2.7 , have tried few options (which dont elegant). suggestions? >>> d = {"africa" : { "name" : "africa", "men": 33333, "women" : 30000, "priority" :3}, "asia"

templates - mosMainBody not displaying com_content -

on old joomla installation (version 1.0.13), i've been asked come in fresh , see if can figure out. everything working ok , permissions set correctly. this error due because of "too new" php version (newer 5.3.x) on old joomla installations. one workaround downgrade php version. another, in case not keen upgrade joomla version or downgrade php version, is: go [webroot]includes/cache/lite/function.php . and find $arguments = func_get_args();a replace following code: $arguments = func_get_args(); $numargs = func_num_args(); for($i=1; $i < $numargs; $i++) { $arguments[$i] = &$arguments[$i]; }

ios - Compare a enum type in a If -

i'm having problems comparing enum type. this enum: enum typeson {folder, service}; enum typeson *type; and have 1 method on class return method type. -(void) settype: (enum typeson) t; -(enum typeson) gettype; and if this, works: nslog(@"object type: %d", [[[actualnode sons] objectatindex:indexpath.row] gettype]); it returns 1 or 0 depends on type. problem when this: if (![[[actualnode sons] objectatindex:indexpath.row] gettype]==service) { nslog(@"this service type"); } it doesn't work. have tried change 'service' 1, '1'... nothing happens. thanks // ! shouldn't there. // v if (![[[actualnode sons] objectatindex:indexpath.row] gettype]==service) { nslog(@"this service type"); }

Javascript onClick functions not working -

i've got money management system i'm trying write, , it's not working correctly. money printed in top right, when click on buttons change value, not work. html: <div id="content"> <div id="money_count">$$money$$</div> <br> <div id="items"> <table> <tr> <td><a href="#">$12.19</a> </td> <td><a href="#">$15.00</a> </td> </tr> <tr> <td><a href="#">$24.99</a> </td> <td><a href="#">$35.50</a> </td> </tr> </table> </div> </div> css: #content { font-family:helvetica; width:500px; box-shadow:0px 0px 10px 0px #aaa; top:30px; margin:0px auto; margin-top:40px; padding:10px 20px; border:dashed 2px #88

PHP User System Security -

i have small internal website charity, it's staff login access documents , rota. although it's meant users on web it's public therefore i'm still thinking security. need opinions on following because i'm not experienced. i've stored 2 cookies when user logs in. first user id , second cookie id people can't change user id , logged in cookie id needs match. it's compared database every page. problem cookie id random number take no time pc cycle through range of few hundred thousand combinations find matching id each user. how can stop this? php's uniqid enough? what other attacks should consider, apart sql injection (already prevented) thanks store client ip of each session on server. if client ip session changes, that's suspicious. another thing give sessions lifetime. like, invalidate session if nothing happened arbitrary amount of time. last not least, store random id in session database , map user instead of storing use

asp.net - Adding Session Variable as OleDbParameter - running into error " -

i using custom asp.net control found here: http://www.codeproject.com/articles/5347/datacalendar i have used 1 of templates in source file download-able page above starting point custom calendar. aim display events current user has created. doing creating session variable called "username" , parameterizing in query so: function geteventdata(startdate datetime, enddate datetime) datatable '--read data access query dim con oledbconnection = getconnection() dim cmd oledbcommand = new oledbcommand() cmd.connection = con cmd.parameters.addwithvalue("@currentuser", session("currentuser")) cmd.commandtext = string.format("select eventdate, createdby, count(*) eventinfo (createdby = @currentuser) , eventdate >= #{0}# , eventdate <= #{1}# group eventdate", _ startdate, enddate) dim ds dataset = new dataset() dim da oledbdataadapter = new oledbdataadapter(cmd) da.fill

struts2 - How to display struts action message in a popup? -

i new struts 2. want display action message popup in asp. have user creation form redirects page. after user created want display popup saying "user username added successfully", username property set in action class form. please me. you can put username in session before returning , access username session inside popup.

wpf - Preventing tabitem to be in multi lines -

i creating application.in application using tabcontrol in wpf problem whenever decreases size of window tabitems settles multiline , arrangement messed up.so please give me solution tabcontrol should remain in single line. have @ this . looks want. edit : old link looks dead, try this answer instead.

android - Images from my website won't load in mobile browsers -

i'm building basic 'hello world' html/css site used coding scratch (previously relied heavily on dreamweaver trial , error!). everything looking great on laptop wanted test how site looked on mobile browser, saved site folder dropbox , tried load home page android phone. the page loads 1 image have doesn't - alt text. case both android's native browser , opera mobile. i have tried both .jpg , .gif file types, , adding in fixed width, height , border value suggested on thread here (this changes shape of alt text placeholder that's all). did add '/' @ tail of <img> tag, again no avail. i'm amazed problem such basic page, have triple-checked code in textbook i'm using, i'm not sure except post here! the html image concerned follows: <div id="banner"><img src="750x262pxbanner.gif" width="100%" alt="banner"></div> i have no css div beyond padding-top: 10px , , image

math - Mutual exclusion truth table? -

can give me truth table of mutual exclusion? a b| result ------------- 0 0| 0 1| 1 0| 1 1| please fill result column reflects mutual exclusion. iirc, xor: 0 0 | 0 0 1 | 1 1 0 | 1 1 1 | 0 apparently, being downvoted because think not xor truth table? here's wikipedia article, truth table looks identical mine: https://en.wikipedia.org/wiki/exclusive_or

r - Sum in a Cross Table -

i new in r. apologies if questions silly. i have sample input data table follows. column-1 column-2 column-3 ff ff 2 nn nn 5 ff ff 2 nn nn 1 fn ff 3 output should ff fn nf nn ff 4 0 0 0 fn 3 0 0 0 nf 0 0 0 0 nn 0 0 0 6 i have used table() function, gives "count", , not "sum". appreciate help! with little known xtabs function. data: l <- c("ff", "fn", "nf", "nn") data <- data.frame( column1 = factor(c("ff", "nn", "ff", "nn", "fn"), levels = l), column2 = factor(c("ff", "nn", "ff", "nn", "ff"), levels = l), column3 = c(2, 5, 2, 1, 3)) xtabs(column3 ~ ., data) # column2 # column1 ff fn nf nn # ff 4 0 0 0 # fn 3 0 0 0 # nf 0 0 0 0 #

php - Detect if user is using an iDevice -

is there way detect if user using idevice without reading user-agent (which spoofed)? want have mobile version (which have no captcha), desktop version have captcha, want use other methods of checking other ua-checks. according know, can't detected mobile phones without user-agent. in fact, there no other function check mobile device.. you can check lightweight class detection of moblie devices: https://code.google.com/p/php-mobile-detect/

shell - SED command is not working -

i facing problem in below command input_file_name_path="/app/csa/sumit/xyz.out" sed -i "s/^$inputfile=.*/$inputfile='${input_file_name_path}'/g" dashboard.prf error : sed: -e expression #1, char 36: unknown option `s' when using value of input_file_name_path without using "/" working fine..but when use "/" in value of variable input_file_name_path giving error. know problem "/" character. can 1 me resolve problem. any appreciated. you can use @ character instead of / separator, code like: input_file_name_path="/app/csa/sumit/xyz.out" sed -i 's@^$inputfile=.*@$inputfile='${input_file_name_path}'@g' dashboard.prf you can use sed -n , add trailing p test regular expressions without modifying file in question , displaying if matches, example: sed -n 's@^$inputfile=.*@$inputfile='${input_file_name_path}'@gp' dashboard.prf and print if matches. not idea c

Try, catch statement in C# -

i have following c# code calculating each file's hash in certain, user specified directory. point works fine, until encounters file cannot access. when finds this, throws error message , exits program. want instead is, throw error message name of file cannot accessed, write there error in accessing file, , continue executing program other files in directory. if can me edit code , achieve things glad. private void sha256directory(string directory) { try { sha256 directorysha256 = sha256managed.create(); byte[] hashvalue; directoryinfo dir = new directoryinfo(directory); fileinfo[] files = dir.getfiles(); foreach (fileinfo finfo in files) { filestream fstream = finfo.open(filemode.open); fstream.position = 0; hashvalue = directorysha256.computehash(fstream); console.writeline(finfo.name); miscellaneous

c# - ASPX page to return http 500 error message regardless of Web.Config -

i have lot of ajax calls connect aspx page instead of web methods (i don't have control on that). it happens call aspx wrong arguments, , http 500 throw (this want). in cases, need message of error, can handle in javascript ui. problem : don't have control on web.config, because application can use on multiple server. people configuring web.config can whatever want, forwarding http 500... so there neat way sure ui error message, regardless of web.config? well, if end same problem me, , if don't use recent version of asp.net, can create own way pass errors. this means server won't return http 500, http 200 instead json inside tell client problem happened. then, $.ajax or other libraries won't understand that, you'll have handle error case yourself. dirty, don't o unless don't have choice.

c# - Find missing information between 2 lists -

how can find missing information between 2 different lists in the code generates lists private static ienumerable<user> getsomeusers() { var mikesgroups = new list<string> { "group1", "group2" }; var mike = new user { username = "mike", memberof = mikesgroups }; var davidsgroups = new list<string> { "group3", "group1" }; var david = new user { username = "david", memberof = davidsgroups }; return new list<user> { mike, david }; } private static ienumerable<group> getgroups() { var group1users = new list<string> { "mike", "david", "kim" }; var group1 = new group { name = "group1", members = group1users }; var group2users = new list<string> { "mike", "david","kim" };

asp.net - Send Notification on Iphone and Android with real time -

i using sql server 2008 , asp.net c#.now want push notification android , iphone through email or sms...how can accomplish it.i searched found different methods iphone , android.is there way send notification android , iphone app simultaneously using same code? please provide , code example if u can. many thnks instead of email or sms can use webservice. have work on ios application , database communication use web service talks application , save data , fetch data. you add web service path ios application web service return xml result , ios application can read details , work accordingly. thank you.

c++ - Allow User To Input Data For A Sudoku Solving Program? -

i trying allow user input values sudoku solver keep getting error. here code: #include <iostream> // #include <fstream> using namespace std; class sudokuboard; void printb(sudokuboard sb); typedef unsigned int uint; const uint maxval = 9; const uint l = 9; const uint c = 9; const uint s = l * c; const uint zonel = 3; const uint zonec = 3; const uint zones = zonel * zonec; const uint lineelements[l][c] = { { 0, 1, 2, 3, 4, 5, 6, 7, 8}, { 9, 10, 11, 12, 13, 14, 15, 16, 17}, {18, 19, 20, 21, 22, 23, 24, 25, 26}, {27, 28, 29, 30, 31, 32, 33, 34, 35}, {36, 37, 38, 39, 40, 41, 42, 43, 44}, {45, 46, 47, 48, 49, 50, 51, 52, 53}, {54, 55, 56, 57, 58, 59, 60, 61, 62}, {63, 64, 65, 66, 67, 68, 69, 70, 71}, {72, 73, 74, 75, 76, 77, 78, 79, 80} }; const uint columnelements[c][l] = { { 0, 9, 18, 27, 36, 45, 54, 63, 72}, { 1, 10, 19, 28, 37, 46, 55, 64, 73}, { 2, 11, 20, 29, 38, 47, 56, 65, 74

asp.net mvc 3 - How to get element of List<string> in foreach -

this action [childactiononly] public partialviewresult archivesidebar() { var currentdate = datetime.now; var list = new list<string>(); (var startdate = new datetime(2013, 5, 1); startdate.month <= currentdate.month; startdate = startdate.addmonths(1)) { list.add(startdate.tostring("mmmm, yyyy")); if (startdate.month == currentdate.month) break; } return partialview("_archivesidebar", list); } and _archivesidebar @model list<string> <div class="sidebar"> <h3>archive</h3> @foreach (string archive in model) { <ul> <li> <h3>{ @html.actionlink(archive, "archive", "blog",new{month=archive?,year=archive ?},null) } </h3>

Find duplicate job names in BMC control-m -

i need find duplicate job names in order change them. how do in bmc control-m? if running control-m on unix export jobs ctmexdef , work these files. export jobs: #!/usr/bin/bash table in `ctmpsm -schedtab -listtable "*" | sed '1d' | awk '{print $2}'` ctmexdef -table $table -action define -file /tmp/${table}.out done print duplicate jobs: grep ctmdefine /tmp/*.out | uniq -d

php - Extract from string using regex -

this question has answer here: how use square bracket inside php regex class? 5 answers i need extract piece of string. have extract system.cpu.util[,idle] or net.if.out[eth2] respectively idle , eth2 . i don't know how detect correcty [ , ] can me? here manual preg_match var= net.if.out[eth2] preg_match('/\[,?(.*?)\]/', $var, $match); print match[1];

php - Page refreshing on Submit -

i'm following tutorial: http://www.plus2net.com/php_tutorial/ajax-search.php they provided me i'm looking for. problem i'm facing is, when press enter button, page refreshing :( don't want that. demo: http://www.plus2net.com/php_tutorial/ajax-search-demo.htm html code <html> <body> <style> #displaydiv { background-color: #ffeeaa; width: 200; } </style> <script type="text/javascript"> function ajaxfunction(str) { var httpxml; try { // firefox, opera 8.0+, safari httpxml = new xmlhttprequest(); } catch (e) { // internet explorer try { httpxml = new activexobject("msxml2.xmlhttp"); } catch (e) { try { httpxml = new activexobject("m

php - General tree traversal(infinite) in breadth-first search manner -

Image
i have tree structure each node has 5 child nodes , more not allowed. wish traverse tree in breadth-first search manner. now wish calculate empty node selected parent using breadth-first search manner. e.g. if given parent 1, function must return node 4 because has positions available. if given parent 2, must return node 7 i using php(codeigniter) + mysql this. my controler public function addmember() { $current_node = $this->input->post('member'); $empty_location = $this->tree_model->getemptypositions($current_node); if($empty_location != 0) { echo "position available"; } else { $next_nodes = $this->tree_model->getallchilds($current_node); $i=0; for($i=0;$i<5;$i++){ $result = $this->tree_model->getemptypositions($next_nodes[$i]); if($result != 0 ) { $current_node = $next_nodes[$i]; goto exe; }

asp.net - Required field validator of the textbox -

i have 1 drop down , 2 text boxes start date , end date .the required field validator end date i'm enabling depending on value of drop down selected. all of validation part i'm doing inside client side using validatorenable() built in function of javascript calling due onchange() function of drop down. all of working fine on change of value of drop down first time. when i'm doing post , during there failure of client side validation,the required field validator of end date text box not retained. lack of code makes hard diagnose, sounds enabling validation based on value of dropdown selected , when user changes value of dropdown... same validation call when page loads , not when select item dropdown list. on page load if dropdown list has selected value, validation should enabled , work expected. also should fix there no postback on client side validation failure.

php - Yii transaction not rollbacked -

Image
i have following piece of code , pass data generate exception , test if transaction rollback happening. seems it's not , i'm not sure why. can me? thanks $transaction = yii::app()->db->begintransaction(); try { //..... //call private methods $category = mycontroller::savecategory($params); $test_saved = mycontroller::savetest($params); mycontroller::savecommunity($param); // here exception , should rollback transaction doesn't $transaction->commit(); } catch(exception $e) { $transaction->rollback(); throw new exception($e); } private function savecommunity($param){ $community = new community(); $community->user_id = $user_id; $community->name = $name; $community->id = 71; // dup

javascript - How can I get less.js and bootstrap to work? -

i'm trying bootstrap , less.js working can't succeed... have not worked less in past, i'm wondering if i'm missing something... runing on synology server. on runtime seems generate boostrap css should "less:sandbox-css-bootstrap" append html does'nt value variables.less here's head <meta charset="utf-8"> <style> body { padding-top: 60px; /* 60px make container go way bottom of topbar */ } </style> <script type="text/javascript" src="js/jquery.min.js"></script> <script src="js/bootstrap.js"></script> <link rel="stylesheet/less" type="text/css" href="css/bootstrap.less"> <script type="text/javascript" src="js/less-1.3.3.min.js"></script> <!-- html5 shim, ie6-8 support of html5 elements --> <!--[if lt ie 9]> <script src="../assets/js/html5shiv.js"></sc

intuit partner platform - Current Customer List? -

i testing aggcat service , trying put prototype. i'm using .net devkit , have gotten through authentication issues including mfa. unfortunately, i'm getting "forbidden" says i've hit max-accounts error. i'm thinking has happened there orphan users/customers in profile need purge (probably failed tests). how can list of defined customer entities in account? can create aggcat service using customer id , once i've done there's no way can find list customers. while in development, if doing discoverandaddaccounts call financial institution have more 10 accounts, or if result of call put on 10 account limit, receive error. instance, if have 2 accounts in system , discoverandaddaccounts @ fi have 9 accounts, system recognize , stop adding additional 9 accounts.

How to #define variable in C -

i have file called config.h following... #define gl_doom then have following in file m_misc.c... #include "config.h" ... #if ((defined gl_doom) && (defined _msc_ver)) logd("using glboom-plus.cfg"); #define boom_cfg "glboom-plus.cfg" #else logd("using prboom-plus.cfg"); #define boom_cfg "prboom-plus.cfg" #endif but says... 05-02 14:40:24.789: d/doom(2966): using prboom-plus.cfg what deal here? new c missing? let's take following code: #define gl_doom #define _msc_ver #if ((defined gl_doom) && (defined _msc_ver)) logd("using glboom-plus.cfg"); #else logd("using prboom-plus.cfg"); #endif i can compile code g++ -e output result of preprocessor. let's @ output. # 1 "blah.c" # 1 "<built-in>" # 1 "<command-line>" # 1 "blah.c" logd("using glboom-plus.cfg"); so, me, implies don't have both gl_doom

ios - Draw UIPageControl Indicator With Core Graphics? -

Image
i want draw following uipagecontrol indicator: i have following code, results in: if (ishighlighted) { uibezierpath *ovalpath = [uibezierpath bezierpathwithovalinrect:cgrectmake(0, 0, 6, 6)]; [[uicolor blackcolor] setstroke]; [ovalpath stroke]; [ovalpath addclip]; uicolor *lightgradientcolor = [uicolor colorwithred:0.8 green:0.8 blue:0.8 alpha:1.0]; uicolor *darkgradientcolor = [uicolor colorwithred:0.1 green:0.1 blue:0.1 alpha:1.0]; cgfloat locations[2] = {0.0 ,1.0}; cfarrayref colors = (__bridge cfarrayref) [nsarray arraywithobjects:(id)lightgradientcolor.cgcolor, (id)darkgradientcolor.cgcolor, nil]; cgcolorspaceref colorspc = cgcolorspacecreatedevicergb(); cggradientref gradient = cggradientcreatewithcolors(colorspc, colors, locations); cgcontextdrawlineargradient(context, gradient, cgpointmake(cgrectgetmaxx([ovalpath bounds]), 0), cgpointmake(0, cgrectgetmaxy([ovalpath bounds])), (cggradientd

php - Restrict web api to web server -

this question has answer here: how can prevent arbitrary client apps using anonymous web api? 4 answers currently when want data database through ajax use external php file grabs data database mysqli , echoes results , sends data ajax. i want change more effective solution. thought first change php file outputs json data future projects , easier data managament. don't want else able access data directly other through website. , since can see ajax connection inspecting website it's easy find out. i don't want become place can access raw json data , build own applications/websites from. what other solutions there? web server should able access it. estabilish session when user access site check session before answering ajax call note, isn't bombproof, starting point.

android - Change external shape color in XML -

so, if have shape : <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <corners android:radius="10dp"/> </shape> and want have shape in selector : <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/somedrawable" android:state_focused="true" android:state_pressed="true"/> <item android:drawable="@drawable/someotherdrawable" android:state_focused="false" android:state_pressed="true"/> <item android:drawable="@drawable/someotherotherdrawable"/> </selector> how use shape in selector , set color of it? possible in in xml? have use <include /> tag this: <item > <include layout="@drawable/myshape" android:color="#987" /> </item>

c# - JSON.NET won't deserialize into my object, throws an exception -

my json (mystring) looks this: "http://d.opencalais.com/dochash-1/0701d73f-2f99-39e1-8c29-e61ee8bf3238/cat/1": { "_typegroup": "topics", "category": "http://d.opencalais.com/cat/calais/law_crime", "classifiername": "calais", "categoryname": "law_crime", "score": 0.869 } i trying deserialise above exact string object: public class opencalaisresult { public string _typegroup {get; set; } public string category { get; set; } public string categoryname { get; set; } public string classifiername { get; set; } public decimal score { get; set; } } i trying code: opencalaisresult myobject = (opencalaisresult)jsonconvert.deserializeobject(mystring, typeof(opencalaisresult), settings); i exception: {"error converting value \" http://d.opencalais.com/dochash-1/0701d73f-2f99-39e1-8c29-e61ee8bf3238/cat/1 \" type 'myapp.parsers.

c# - Open IE Explorer Bar By changing registry -

i trying implement internet explorer following steps in below link http://msdn.microsoft.com/en-us/library/aa753590.aspx everything done, want, when open ie, toolbar should open on own. i assume have change registry value, how ever not able get, how can achieve that, appreciated.

jdbc - clojure sqlkorma library: out of memory error -

i'm doing thought straightforward task: run sql query (over 65k rows of data) using sqlkorma library ( http://sqlkorma.com ), , each row transforming in way, , writing csv file. don't think 65k rows large given have 8gb laptop, assumed sql result set lazily fetched , whole thing never held in memory @ same time. really surprised when ended stack trace: exception in thread "main" java.lang.outofmemoryerror: java heap space @ clojure.lang.persistenthashmap$bitmapindexednode.assoc(persistenthashmap.java:777) @ clojure.lang.persistenthashmap.createnode(persistenthashmap.java:1101) @ clojure.lang.persistenthashmap.access$600(persistenthashmap.java:28) @ clojure.lang.persistenthashmap$bitmapindexednode.assoc(persistenthashmap.java:749) @ clojure.lang.persistenthashmap$transienthashmap.doassoc(persistenthashmap.java:269) @ clojure.lang.atransientmap.assoc(atransientmap.java:64) @ clojure.lang.persistenthashmap.create(persistenthashmap.java:56) @ clojure.lang.persistent

javascript - Chrome desktop notification for dynamic site update when chrome runs in background -

i've created bookmark extension community website, host posts, need have desktop notification of new posts in community site. chrome runs on background, no tabs opened, unless notified desktop notification. idea send message background page content script regular interval , updates on post , display desktop notification, thereby user opens update on seeing notification. query: how access dom of website (when chrome running in background), hiding extraction process user eye. thanks !! edit var statone; var xhr = new xmlhttprequest(); xhr.open("get", "https://www.dsswym.3ds.com/", true); xhr.onreadystatechange = function() { if (xhr.readystate == 4 && xhr.status==200) { settimeout(function(){ //wait webpage loading statone = $('#widgetpanel-7qrsn8cawqkk0dp2_gqk').text(); console.log(statone); alert(statone); }, 10000); } } xhr.send(); i'm not able text values on above code, instead alert bo

c - Parsing a string separated by Commas using MPLAB Compiler? -

i parsing string separated commas , printing values reason code prints first value if run on mplab c compiler. however, if run code on codeblocks, prints out values. mplab output 2 codeblocks output 2 100 200 100 code: char somestr[] ="2,0100,0200,0100"; char *pt; int a; pt = strtok (somestr,","); while (pt != null) { = atoi(pt); printf("%d\n", a); pt = strtok (null, ","); } i output this 2 0100 0200 0100 so going on ? thanks! i'm wondering how got 0100 , 0200 (using %d specifier, should 100 , 200 , and do ), running code, output should printed. code seems fine. possible reasons why may not case: you have more code invokes undefined behavior , interferes piece of code; this not actual code you're compiling; the terminal or wherever program prints after having been compiled mplab compiler has bug or didn't notice should scrolled; a compiler or standa

algorithm - running estimates of empirical PMF and variation therein, given a RNG -

suppose black-box random number generator continually emits integer values in interval (for case of immediate interest, [0, 255]). want estimate probability mass function , measure of variation, , want periodically update these estimates new samples come in, without having store entire set of samples far. please suggest numerically stable algorithms computing , updating these estimates. please suggest appropriate measure of variation in pmf. the pmf of discrete distribution relative proportion of each outcome. create array of length 256, initialized zeros. each value, increment array @ index. scale total number of observations express result relative proportion (estimated probability). voila, instant empirical pmf, , you're storing 256 values if have millions or billions of observations. if outcomes limited small subset, use hash rather array. given values , associated counts, can construct whatever measures central tendency or variation. variation can c

c# - Transport a byte array in CodeDOM -

how can 'transport' byte array codedom source file? i know how replace strings i'm not sure how transport byte array. the way of doing create string , add bytes string transport string? ps: byte array contains bytes of file. example: in main application i'm getting bytes of exe. in codedom source file need bytes of exe can create file bytes.

android - Facebook 3.0 issue with login -

i trying understand how facebook 3.0 sdk login proccess working. walked through this tutorial. every thing works fine, how should continue? lets after loging in want users email or navigate other activity. should put code in case. have mainactivity code: package com.shaleapp.activities; import android.app.activity; import android.content.intent; import android.os.bundle; import android.support.v4.app.fragmentactivity; import android.util.log; import android.view.menu; import android.widget.textview; import com.facebook.request; import com.facebook.response; import com.facebook.session; import com.facebook.sessionstate; import com.facebook.model.graphuser; import com.parse.parsefacebookutils; import com.shale.fragments.mainfragment; import com.shaleapp.services.init; import com.shaleapp.shale.r; public class mainactivity extends fragmentactivity { private mainfragment mainfragment; @override public void oncreate(bundle savedinstancestate) { super.oncreat

python - Replacing last value in list of tuples -

so, have tuple this: a=[(1, 2, 3), (4, 5, 6), (7, 8, 9)] and want replace last value of each tuple 100. can do: b=[(t[0],t[1],) + (100,) t in a] that gives me this: [(1, 2, 100), (4, 5, 100), (7, 8, 100)]. what's shortcut? these tuples, in real, have 50 elements in it? use tuple slicing: [t[:-1] + (100,) t in a] there no need build new tuple individual elements here.

css - Bootstrap swap grid spans -

working on bootstrap template , while i'd large grid remain in correct order of span4 span8... i'd them reverse span8 span4 when screen size under 768. don't want use js on this... i'd wondering if there way, , how so, float spans left under 768 right. or maybe there better way. diagram <div class="row"> <div class="span4">hello</div> <div class="span8">world</div> </div screen width greater 768 displays hello world screen width less or equal 768 displays world hello add class of 'right' span8, set media query float: right when less 768.

java - How do I count the number of files in HDFS from an MR job? -

i'm new hadoop , java matter. i'm trying count number of files in folder on hdfs mapreduce driver i'm writing. i'd without calling hdfs shell want able pass in directory use when run mapreduce job. i've tried number of methods have had no success in implementation due inexperience java. any appreciated. thanks, nomad. you can use filesystem , iterate on files inside path. here example code int count = 0; filesystem fs = filesystem.get(getconf()); boolean recursive = false; remoteiterator<locatedfilestatus> ri = fs.listfiles(new path("hdfs://my/path"), recursive); while (ri.hasnext()){ count++; ri.next(); }

c++ - Is specifying link dependency required when one static lib is dependent on another static lib? -

this question has answer here: do static libraries, depend on other slibs need actual 'code' them work? 2 answers general question can formulated - if static library lib1 dependent on static library lib2, need specify lib2 linker dependency lib1, or linking dependencies need specified when libraries linked against application (and every application using lib2 should link against lib1 well)? specifically, have bunch of static libs , applications, dependencies between them, that: makeall.pro: template = subdirs config += ordered subdirs = corelib \ anotherlib \ .... someapp anotherlib.depends = corelib someapp.depends = corelib anotherlib corelib.pro template = lib config += staticlib target = corelib #... .cpp , .h anotherlib.pro template = lib config += staticlib includepath += path_to_core_lib_includes dependpath += path_to_core_l

javascript: how to access static properties -

i want access static property using instance. this function user(){ console.log('constructor: property1=' + this.constructor.property1) ; } user.prototype = { test: function() { console.log('test: property1=' + this.constructor.property1) ; } } user.property1 = 10 ; // static property var inst = new user() ; inst.test() ; here same code in jsfiddle in situation don't know class instance belongs to, tried access static property using instance 'constructor' property, without success :( possible ? so tried access static property using instance 'constructor' property that's problem, instances don't have constructor property - you've overwritten whole .prototype object , default properties. instead, use user.prototype.test = function() { console.log('test: property1=' + this.constructor.property1) ; }; and might use user.property1 instead of detour via this.constructor . ca

c# - Alter generated URLs in MVC globally -

i have simple question. i want able change every url gets create helper class in mvc.net, problem don't know have override so. edit: goal change behaviour of mvc when create urls..i want make urls mvc creates seo friendly. after hours of google & bing not smarter... if knows have change something, please give me hint, thank :) get grips routing: http://www.asp.net/mvc/tutorials/older-versions/controllers-and-routing/asp-net-mvc-routing-overview-cs routes found in global.asax file , htmlhelpers actionlink should automatically adapt custom routes. if specify custom route above default route , following, url produced match route: @html.actionlink("go!", "anaction", "acontroller") if specify other parameters in route not available parameters standard overloads of actionlink , can pass these in routevalues parameter: @html.actionlink("go!", "anaction", "acontroller", new { mycustomparame

android - How to use <uses-library> at AndroidManifest.xml -

if have android app , want use filter android app can installed devices has specific library e.g. /system/lib/libabc.so library not available devices, depends on chips company. according http://developer.android.com/guide/topics/manifest/uses-library-element.html , can use i tried adding below line @ androidmanifest.mk , have libabc.so @ /system/lib/ <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:debuggable="true"> <uses-library android:name="libabc.so" android:required="true"/> ... </application> however, still error below installation error: install_failed_missing_shared_library please check logcat output more details. launch canceled! question: how should put name @ "android:name" correlate required library @ /system/lib/libabc.so ?

javascript - Chaining more than two tasks using deferred and can this be use for loops? -

i getting used $.deferred now, , happens needed chain 3 tasks using $.deferred - then . created function: function processa(param1, param2) { log = $.post('http://domain.com/process', { id: param1, another: param2 } ), set = log.then(function(html){ if (somecondition) { console.log('successful'); // want ajax call here // , chain another, ajax again } }) } how do that, stated in comments of code. right? not tested, thought while typing this. set = log.then(function(html){ if (somecondition) { console.log('successful'); $.post(....), def = set.then(function(data){ // want thing here. }) } }) and thing, possible use function in loop? e.g. data = [{param1:"...", param2:"...&q

tablesorter - Jquery plugins interfering with each other -

note: js/jquery noob alert (yes, me) there seems conflict between following 2 plugins: tablesorter (2.9.1) bootstrap-popover.js v2.2.1 the plugins work should separately, when together, popovers don't work. i've tried moving calls popover script (and initialization) before other plugins, no dice. have feeling tablesorter script somehow removing titles dom (another subject know little about) before popover script can load, no dice. in html <script src="../../js/jquery-1.8.2.min.js"></script> <script src="../../js/jquery.tablesorter.js"></script> <script src="../../js/jquery.tablesorter.pager.js"></script> <script src="../../js/tooltips-popovers.js"></script> <script> $(function(){ $("#stats").tablesorter(); }); </script> <script> $("a[rel=popover]").popover({html:true,trigger:'hover'}); </script> <script>

wordpress - WP-PageNavi Issues, Url changes but the posts remain the same? -

the issue having have created new blog page on own page template page being called blog.php, have pulled 5 posts each page , first page work great , link single posts attached too. when try add wp-pagenavi nav-below run issue. happens click go next page , changes url, posts remain same before, when should switching them next set. i don't know if can use wp-pagenavi outside of index.php, if can let me know doing wrong here , why continue same posts awesome , appreciated. have 1 of blogs on blog.php , file trying work. have posted code below. <?php /** * template name: blog page <?php query_posts("posts_per_page=8"); ?> */ get_header(); ?> <div id="content"> <?php query_posts( array( 'post_type' => 'post', 'posts_per_page=5' ) ); ?> <?php //the loop. if( have_posts() ): while( have_posts() ): the_post(); ?> <article id="post-1" <?p

java - How to select one of GWT CellTree nodes after first data fetch? -

i'm trying select first root node of celltree after asynchronous data fetching server. here code: public class mytreemodel implements treeviewmodel{ private myserviceasync myservice = gwt.create(myservice.class); public <t> nodeinfo<?> getnodeinfo(t value) { cell<myto> cell = new abstractcell<myto>() { @override public void render(context context, myto value, safehtmlbuilder sb) { //rendering node... } }; return new defaultnodeinfo<myto>(value instanceof myto ? createbranchdataprovider((myto)value) : //fetching child nodes ceraterootdataprovider(), cell); //fetching root nodes } @override public boolean isleaf(object value) { if (value instanceof myto) { myto = (myto)value; return to.isleafnode(); } return false; } private abstractdataprovider<myto> ceraterootdataprovider() { asyncdatapro