Posts

Showing posts from March, 2014

sql server - sqlsrv drivers slow in codeigniter? -

i have installed latest version of ci 2.1.3 now after running query, getting slow response time simple such as: function bash(){ $sql = “select * contacts”; $stmt = sqlsrv_query( $conn, $sql ); if( $stmt === false) { die( print_r( sqlsrv_errors(), true) ); } after querying remote database. (sql server 2008) when run same query in simple php script against same remote database. results instantly. a) has else experienced problem sqlsrv drivers in codeigniter? if so, how did solve it? here connection string: $db['default']['hostname'] = "xxxxx,1433"; $db['default']['username'] = "xx"; $db['default']['password'] = "xxxxxx-xx"; $db['default']['database'] = "xxxxxxxxx"; $db['default']['dbdriver'] = "sqlsrv"; $db['default']['dbprefix'] = ''; $db['default']['pconnect'] = true; $db['default']

javascript - Dropdown onclick without js, php or target -

i want make onclick dropdown menu without javascript, php can't used. using targets, page jumps every time click on it, because not on top of page. possible make dropdown menu without js , php, onclick? what after possible, though i not advise use technique . nothing less hack, semanticly incorrect, , nightmare seo. this taken account, explain technique proof of concept: first make sure organise html this: <nav> <ul> <li> <label for='item-1'>main item 1</label> <input type="checkbox" id="item-1"/> <ul> <li><a href="#">sub 1</a></li> ... </ul> </li> ... </ul> </nav> some smart use of :checked selector , sibling + selector allows simulate dropdown on click. relevant css this: /* hide checkboxes, there store 'state&#

php - PDO: Invalid parameter number: mixed named and positional parameters -

i have come across warning i've not seen before: warning: pdostatement::execute() [pdostatement.execute]: sqlstate[hy093]: invalid parameter number: mixed named , positional parameters in... referring following pdo query (have simplified function ease of reading): $offset = 0; $limit = 12; function retrieve_search_posts($searchfield, $offset, $limit){ $where = array(); $words = preg_split('/[\s]+/',$searchfield); array_unshift($words, ''); unset($words[0]); $where_string = implode(" or ", array_fill(0,count($words), "`post_title` ?")); $query = " select p.post_id, post_year, post_desc, post_title, post_date, img_file_name, p.cat_id mjbox_posts p join mjbox_images on i.post_id = p.post_id , i.cat_id

android - Per Device subscriptions for purchases through Google Play -

i setup subscription based billing app sold through google play. possible sell same subscription same user on different devices? every device user tries use app on need active subscription? i thinking store device id , user id on own server , authenticate way, correct user can't purchase same subscription more once? need pool of same subscriptions if user wishes purchase multiple "licenses"? can google play billing handle of natively? thanks the documentation google seems make impossible achieve digging deeper, uncovered following... in google play api version 2.0, create called "unmanaged" product type allowed user purchase same thing multiple times. seems have partly disappeared in api 3.0 although gooogle developer console supports this. assume it's still supported because apps used 2.0 api still out there , google can't drop support that. in 3.0 however, "unmanaged" product type not listed in api docs docs state fol

ios - With UIPanGestureRecognizer, is there a way to only act so often, like after x many pixels were panned? -

right uipangesturerecognizer recognizes every single pan, great , necessary, i'm using sliding gesture increase , decrease variable's value, within method want act every often. if increment 1 every time it's detected value goes far fast. is there way like, every 10 pixels of panning this, or similar? you're looking translationinview: , tells how far pan has progressed , can tested against minimum distance. solution doesn't cover case go , forth in 1 direction in amount equal minimum distance, if that's important scenario it's not hard add. #define kminimumpandistance 100.0f uipangesturerecognizer *recognizer; cgpoint lastrecognizedinterval; - (void)viewdidload { [super viewdidload]; recognizer = [[uipangesturerecognizer alloc] initwithtarget:self action:@selector(didrecognizepan:)]; [self.view addgesturerecognizer:recognizer]; } - (void)didrecognizepan:(uipangesturerecognizer*)sender { cgpoint thisinterval = [recognizer

ExtJs 4.2 compiling theme using compass -

according sencha's documentation creating , compiling new themes should done using sencha cmd. i'd create new theme (which inherit existing one) , able compile using compass without sencha cmd. any idea how so? if want create new theme scratch, bit overwhelming , i'd recommend trying extend existing theme first. basically, theme consists of 2 large parts: css templates , javascript overrides; css in turn split between sass code, mixins , variables. there's theming guide discuss theme building 4.2; inheritance examples can take @ existing themes: e.g., gray theme extends classic theme, in turn inherits neutral theme, has base theme parent. neptune can give lots of javascript override examples, too.

c# - how to connect silverlight with sqlite without IsolatedStorageFile -

isolatedstoragefile isf = isolatedstoragefile.getuserstoreforapplication(); isf.deletefile("mydb.db"); using (sqliteconnection conn = new sqliteconnection()) { conn.connectionstring = "version=3,uri=file:mydb.db"; conn.open(); using (sqlitecommand cmd = conn.createcommand()) { cmd.commandtext = "create table test_table ( [id] integer primary key, [col] integer unique, [col2] integer, [col3] real, [col4] text, [col5] blob)"; cmd.executenonquery(); cmd.transaction = conn.begintransaction(); cmd.commandtext = "insert test_table(col, col2, col3, col4, col5) values(@col, @col2, @col3, @col4, @col5);select last_insert_rowid();"; cmd.parameters.add("@col", null); cmd.parameters.add("@col2", null); cmd.parameters.add("@col3", null); cmd.parameters.add("@col4", null); cmd.parameters.add("@col5", null);

javascript - DOJO and DIJIT can not parse same ID twice? -

i having problem while working dojo dynamically load div content , run parser.parse(dom.byid("maindiv")); respective requires. , works beautifully first time. second time end running problem shows content no longer activated or styled. on second run remove html in div , replace html basic unparsed text , parse again. guessing has dijit.registry can not find issue have tried clearing out no avail. appreciated. dojo keeps track of objects / widgets creates specified id. if run parser again on object same id, dojo tries create second instance, there one, should throw error in js console (please check). you leave id blank, dojo / parse should create id you. dojo allows find dom elements class attributes, way pass div-element parse() function without giving explicit id. anotherway destroy created widget/object before parse div-element again, take here that: dojo , unregistering widgets quote http://livedocs.dojotoolkit.org/dojo/parser#parse "if t

c# - Is there a simple way to get query string parameters from a URI in Windows Phone? -

i'm working custom uri scheme validate users using oauth. in order this, need values of parameters query string. is there simple way information? or option using regex or other string manipulation? i have found references things parsequerystring, these contained in libraries not available on windows phone. after lot of searching landed on simple approach. long query strings kept simple (as in oauth) method should work. public static dictionary<string, string> parsequerystring( string uri ) { string substring = uri.substring( ( ( uri.lastindexof('?') == -1 ) ? 0 : uri.lastindexof('?') + 1 ) ); string[] pairs = substring.split( '&' ); dictionary<string,string> output = new dictionary<string,string>(); foreach( string piece in pairs ){ string[] pair = piece.split( '=' ); output.add( pair[0], pair[1] ); } return output; }

c++ - What is the race condition in this code? -

the following implementation of sleepconditionvariablecs , wakeallconditionvariable , , thread creation functions. problem when try create thread creating thread gets stuck on waitforsingleobject( cv->mut, infinite ); in sleepconditionvariablecs . cant figure out race condition here is. typedef struct { int waiters_count; handle sema_; handle mut; } condition_variable; void sleepconditionvariablecs(condition_variable *cv, critical_section *cs, int32_t dwmilliseconds){ waitforsingleobject( cv->mut, infinite ); //acuire object lock cv->waiters_count++; leavecriticalsection (cs); if (signalobjectandwait(cv->mut, cv->sema_, dwmilliseconds, false) == wait_timeout){ //signalobjectandwait releases lock cv->waiters_count--; } entercriticalsection(cs); } void wakeallconditionvariable(condition_variable *cv){ waitforsingleobject( cv->mut, infinite ); while (cv->waiters_count > 0){ cv->waiters_count =

ember.js - jshint complains: 'Ember' is not defined -

i have standard ember main.js file, starts this: this.app = ember.application.create({ log_transitions: true, version: '1.0.0', ready: function () { console.log('app version: ' + app.version + ' ready.'); } }); running through jshint complains ember not being defined, true particular file in server, during deployment phase. because of this, lots of error messages shown. ember made available in browser script tag in index.html : <script src="scripts/vendor/ember-1.0.0-rc.2.js"></script> how can tell jshint ember ? the following should it: /*global ember */ this.app = ember.application.create({ log_transitions: true, version: '1.0.0', ready: function () { console.log('app version: ' + app.version + ' ready.'); } }); found in js hint docs

How can you monitor for click events in Google Apps script for spreadsheets? -

i'm managing google spreadsheet script. onedit function working great - can colour cell red putting spreadsheetapp.getactiverange().setbackgroundrgb(255, 0, 0); in onedit function. do, however, put same code in onclick function, when user clicks on cell turns red. possible do? can't find way in documentation. as stated on comments above before there's no way (right now) create onclick() function google spreadsheets. makes sense due fact google app script functions processed in server, amount of load generated onclick() events execution make pretty easy deplete quota of requests provided default. you should using documentation creating button , clicking on it .

php - Link two arrays and use them like MySQL DB -

im trying mate , shes sticking arrays no database use time :( countys page shows countys , when 1 clicked taken different page displaying walks county. $countys = array(); $countys[101] = array( "name" => "armagh", "img" => "css/images/map.jpg", "largeimg" => "css/images/banmap.jpg" ); $countys[102] = array( "name" => "antrim", "img" => "css/images/map.jpg", "largeimg" => "css/images/banmap.jpg" ); $walks = array(); $walks[1] = array( "name" => "portadown walk", "county" => "armagh", "img" => "css/images/map.jpg", "location" => "portadown", "largeimg" => "css/images/banmap.jpg" ); $walks[2]

Mathematica Issue -

can familiar mathematica tell me why drawing wont generate? plot1 = contourplot3d[{x^2 + (y + 0.25)^2 + (z - 0.45)^2 = 0.25, x^2 + y^2 + (z + 0.5)^2 = 0.25, x^2 + (y + 0.5)^2 + (z - 1.4)^2 = 0.25, x^2 + (y + 0.25)^2 + (z - 2.35)^2 = 0.25, x^2 + y^2 + (z - 3.3)^2 = 0.25, x^2 + (y + 0.25)^2 + (z - 4.25)^2 = 0.25, x^2 + (y + 0.5)^2 + (z - 5.2)^2 = 0.25, x^2 + (y + 0.25)^2 + (z - 6.15)^2 = 0.25, x^2 + y^2 + (z - 7.1)^2 = 0.25}, {x, -3, 3}, {y, -3, 3}, {z, -3, 3}] plot2 = contourplot3d[{x^2 + (y - 0.5)^2 + (z - 0.25)^2 = 0.25, x^2 + (y - 0.75)^2 + (z - 1.15)^2 = 0.25, x^2 + (y - 1)^2 + (z - 2.05)^2 = 0.25, x^2 + (y - 1.25)^2 + (z - 2.95)^2 = 0.25, x^2 + (y - 1.5)^2 + (z - 3.85)^2 = 0.25, x^2 + (y - 1.75)^2 + (z - 4.75)^2 = 0.25}, {x, -3, 3}, {y, -3, 3}, {z, -3, 3}] plot3 = contourplot3d[{x^2 + (y + 0.5)^2 + z^2 = 0.25, x^2 + (y + 1)^2 + (z - 0.75)^2 = 0.25, x^2 + (y + 1.5)^2 + (z - 1.5)^2 = 0.25, x^2 + (y + 2)^2 + (

getting external web page with in another mobile web site/ mobile web page -

i trying create web page fixed download button @ bottom , top area calling page has link, when click link, take external webpage. call either div or object. tried iframe, links within external page not able click. please 1 me. <div id="siteloader"></div> <script src="http://code.jquery.com/jquery-1.7.2.min.js"></script> <script> $("#siteloader") .html('<object data="h2.htm" style="width:100%; height:100%;"/>'); </script> <div id="downloadbutton"> <input id="dbutton" type="submit" src="download.png" value="" alt="submit" /> </div>

html - IE9 CSS Issues with arrangment of two items in li -

have of please: jsfiddle in firefox, chrome, opera code ok, in ie9 shift numbers, see picture please. left ok, right ie9. http://imageshack.us/photo/my-images/707/asdlj.png/ i can´t solve problem, need :( html <ul id="category"> <li> <p> 35 </p> spiele </li> <li> <p> 352 </p> puppen </li> </ul> css ul { list-style: none; margin: 0; padding: 0; } #category { float:left; background:#e8e8e8; } #category li { line-height: 20px; padding: 10px 30px; cursor:pointer; } #category p { margin:0 0 0 20px; padding:0; float:right; font-size:18px; } i've simplified code considerably. stenzg i believe qualify time use <table> . cleaner , compatible way of handling particular issue. won't run browser issues. try this: <table> <tr> <td&

kendo autocomplete on numeric field -

trying use autocomplete datatextfield integer. keep getting "tolower" or "indexof" error. cant find single example of trying autocomplete numbers. ps: works fine text field http://jsfiddle.net/nslp8/ $("#autocomplete").kendoautocomplete({ datatextfield: "value", select: function(e) { var dataitem = this.dataitem(e.item.index()); //output selected dataitem $("#result").html(kendo.dataitem); }, datasource: { data: [ { id : 1, value: 1 }, { id : 2, value: 2 }, { id : 3, value: 3 }, { id : 4, value: 4 } ] } }); as workaround, can try adding tolowercase() prototype number $(document).ready(function() { if (!number.prototype.tolowercase) { number.prototype.tolowercase = function() { return this.tostring(); } } }); $(document).ready(function() { if (!number.prototype.tolowercase)

jquery - How to wait for ajax call of another element's click event to finish -

this question exact duplicate of: check once function complete 2 answers i'm trying call element's click event inside click event window.location.href = mailto:emailaddress problem other element has ajax call , window.location.href seems cancelling ajax call. there easy way wait ajax call inside click event finish before executing window.location.href in scenario? here sample of html & javascript: <a id="email-link" href="mailto:emailaddress@email.com">emailaddress</a> <div class="right" id="list-items"> <ul> <li>item 1</li> <li>item</li> </ul> </div> <script type="text/javascript"> $('#list-items').live('click', function () { jquery.ajax({ url: "@url.action("index", "

jquery - Javascript:Replace single characters after the string -

i'm trying seems basic, can't seem working. i'm trying strip characters after last instance of underscore. i have long query string: json_data=demo_title=demo+title&proc1_script=script.sh+parameters&proc1_chk_make=on&outputp2_value=&demo_input_description=hola+mundo&outputp4_visible=on&outputp4_info=&inputdata1_max_pixels=1024000&tag=&outputp1_id=nanana&proc1_src_compresion=zip&proc1_chk_cmake=off&outputp3_description=&outputp3_value=&inputdata1_description=input+data+description&inputp2_description=bien%3f&inputp3_description=funciona&proc1_cmake=-d+cmake_build_type%3astring%3drelease+&outputp2_visible=on&outputp3_visible=on&outputp1_type=header&inputp1_type=text&demo_params_description=va+bien&outputp1_description=&inputdata1_type=image2d&proc1_chk_script=off&demo_result_description=win%3f&outputp2_id=nanfdsvfa&inputp1_description=funciona&demo_wai

jnlp - How to ensure Java Web Start to download and install the lastest version -

i have jdk 1.6 install on machine want run code on jre 1.7+ there method ensure using jnlp latest jre automatically download , install? here current content of jnlp file. <java href="http://java.sun.com/products/autodl/j2se" version="1.7.0_17" java-vm-args="-ea" initial-heap-size="128m" max-heap-size="512m" /> i have tried : <java href="http://java.sun.com/products/autodl/j2se" version="1.7+" java-vm-args="-ea" initial-heap-size="128m" max-heap-size="512m" /> i using direct proxy in java web start control panel , option automatically download of jre enabled. getting message manually install jre version , application stop. please let me know if further information required. not wants client manually install jre. operating system: red hat linux jnlp file verified using janela

design patterns - C# style enums in C++ -

i'm trying write log library use external tool i'm looking convenient way add key-strings output stream parsing external tool while having least impact on programmer using library the goal achieved this: cout << debug::verbose << "a should equal 3" << endl; cout << debug::warning << "something went wrong" << endl; for structured data following struct debug { static const std::string fatal_error; static const std::string error; static const std::string warning; static const std::string important; static const std::string information; static const std::string verbose; static const std::string debug; }; this works find add level of abstraction std::string type. in java/c# use enum achieve write behavior, how can implement in c++ elegantly. i think in c++ iostreams, stream manipulators in style of endl more idiomatic: #include <iostream> namespace debug { std::ostream & info(std:

android tutorials screen -

i confused topic, had ask. being new on android, thinking of creating introductory sort of tutorial page app working on, one's see on various apps used first time in point out various features of app, functionality button perform when pressed, menu item do, in sort of dynamic way. what these ?? splash screens ? or different? i made tutorial screen app. did in case : 1) create snapshots of activities , functions. 2) used photoshop put different markers defining different areas in snapshot , do. (which similar link posted in above comments) 3) used imageswitcher next button @ bottom. @ start of app if user wants view tutorial start activity imageswitcher. 4) cycle through snapshots of next button below imageswitcher. 5) on last image of imageswitcher launch intent open main screen of actual app. hope helps!!!

javascript - Cannot put a button in SlickGrid cell -

i trying put button in cells of 1 of columns , when it's clicked. for example add these lines slickgrid example 1 ( http://mleibman.github.io/slickgrid/examples/example1-simple.html ) first column array add: {id: "report", name: "report", field: "report", width: 40, sortable: true, formatter:reportformatter} then add: function reportformatter(row, cell, value, columndef, datacontext) { return "<input type='button' value='show' id='reportbtn'/>"; } $('#reportbtn').click(function() { alert("hello"); }); the buttons appear in cells click event not being called ! must doing wrong can't life of me figure out can ? thanks! use precompiled template slick grid example. add property eg. imagetrial, , in data structure fill property dynamic input button. <script type=" " id="testtemplate"> <div cla

linux - listing multicast sockets -

i trying list opened multicast sockets on linux system? netstat -g lists groups joined though. there other utility can use sake? thanks lot help. in addition netstat -g can use see sockets bound multicast address: netstat -anu|sort -nk4 this list of udp sockets (whether multicast or not). addresses in range 224.0.0.0 239.255.255.255. these sockets bound multicast addresses, regardless whether joined multicast group or not. these only receive traffic multicast group. but: in practice udp sockets used receive multicast traffic bound address 0.0.0.0. these can receive udp packets unicast , multicast addresses, , server additional filtering based on source-ip-address. so in list above may want @ udp sockets bound 0.0.0.0, example 0.0.0.0:5353 mdns (avahi, zeroconf) server.

sip - MjSIP/AsteriskNOW 403 Forbidden - Wrong Password -

i struggling mjsip , right have problem registring sip client sip registrar (asterisknow distro : freepbx + asterisk + centos). to perform register transaction used extendedinvitedialog class , extendedinvitedialoglistener interface, send first message request() , detect server's answer ondlgaltresponse() , answer ackwithanswer(). here's source code of ondlgaltresponse(invitedialog arg0, string arg1, int code, string arg3, string arg4, message resp) : if (code==401){ if (resp.haswwwauthenticateheader()) { nonce = resp.getwwwauthenticateheader().getnonceparam(); realm = resp.getwwwauthenticateheader().getrealmparam(); authorizationheader ah = new authorizationheader("digest"); message.setcseqheader(message.getcseqheader().incsequencenumber()); viaheader vh=message.getviaheader(); string newbranch = sipprovider.pickbranch();

c++ - getting value from QSpinBox created in a QFormLayout -

i wondering how refer qspinbox s created code qformlayout* layout = new qformlayout; layout->addrow(new qlabel(tr("board size")), new qspinbox); layout->addrow(new qlabel(tr("number of \nstarting moves")), new qspinbox); layout->addrow(new qlabel(tr("seed value")), new qspinbox); this in void function creates form layout, applies qwidget f , sets f widget qdockwidget added qmainwindow. i need use values in qspinbox s running function, have no clue how differentiate between or reference boxes. know qspinbox s have value() function, how call on each different box? sorry if using qt in unusual manner, new qt programming. also, not want use visual programming, want code everything. in advance! first of - creating widgets without specifying parent potential memory leak, shouldn't it, unless know doing. second of all, if want use value in class - should make pointer member of class , address name (l

ios - Cannot edit provisioning profile under new Apple web interface -

Image
i have update apple provisioning profile add new udid, , when logged apple dev account looks apple have changed parts of dev site. i able add new udid without issue, when try update provisioning profile by: provisioning profiles --> development --> select profile --> click "edit" --> add new device profile the "generate" button doesn't change disabled state clickable state. after changing changeable fields (profile name, included certificates, devices), "generate" button still refuses enabled. below screenshot of issue, can see "generate" in disabled state: what need know how update provisioning profile, problem me editing wrong, or because of bugs new interface. edit 1 looks isn't browser specific. situation same on win7 chrome , on osx safari (older & newer version). however, did find large part of site doesn't work on win7 ie9, click on number of buttons , nothing happens. it seems ne

python - Uppercase package name issue with enpkg -

i'm trying install 'qt' package epd free edition install using enpkg tool. on windows. enpkg works ok lowercase packages: h:\>enpkg pandas prefix: c:\python27 no update necessary, 'pandas' up-to-date. pandas-0.10.1-1.egg installed on: mon apr 08 15:07:14 2013 but seems handle uppercase package names incorrectly: h:\>enpkg qt prefix: c:\python27 no egg found requirement 'qt'. h:\>enpkg "qt" prefix: c:\python27 no egg found requirement 'qt'. i know qt available can install on mac os x, , see in epd package directory: http://www.enthought.com/products/epdlibraries.php how can fix problem? as you've discovered, not issue of case sensitivity. what use in python not qt directly python wrappers qt, might either pyside (available free users) or pyqt4 (gpl license, available subscribers, not available on osx-64). enthought recommends using pyside unless have unusual requirements pyqt4 wrappers. so should

java - Hibernate Criteria join to table containing foreign key -

i have 2 tables: client (clientid, firstname, lastname, gender) event (clientid, eventid) i need represent query similar following using criteria: select c.clientid, c.firstname, c.lastname, c.gender, max(eventid) client c join event e on c.clientid = e.clientid group c.clientid, c.firstname, c.lastname, c.gender i have tried this: final criteria criteria = session.createcriteria(client.class); criteria.setfetchmode("event", fetchmode.join); criteria.setprojection(projections.projectionlist().add(projections.groupproperty("clientid")).add(projections.max("eventid"))); but throws exception on last line message: hibernatequeryexception: not resolve property: eventid of: client how can specify join between client table contains no column related event table clientid column on event table foreign key client table? as can see, it's driven off client table , need select maximum eventid event table. also, mentioned, trying

SQL Server Setup Error in Visual studio 2010 -

i have installed sql sever 2012 ssdt. when using ssdt , creating package.it gives error: microsoft visual studio unable load document: design integration services packages in sql server data tools (ssdt),ssdt has installed 1 of these edition of sql server 2012:standard,enterprise,developer,or evaluation. i using sql server 2012 enterprise edition. ssdt installed on machine. i dont know y rhis error occured???. please me refer discussion in following link http://social.msdn.microsoft.com/forums/en-us/sqlintegrationservices/thread/6dce2f25-2f73-4f69-8d37-06483ada79da/ as go through step step approach: http://learnsqlwithbru.com/2011/12/12/getting-started-with-ssdt-sql-server-data-tools/ hope helpful.

infinite loop caused by append SWi prolog -

i trying code adds value list empty. program keeps going infinite loop or out of stack, when using append. i using swi prolog , new prolog. getcardvaluelist([],[_]). getcardvaluelist([h|ts],[_]):- getcardvalue(h,val), append([_],[val],vl), getcardvaluelist(ts,vl). append([x|y],z,[x|w]) :- append(y,z,w). append([],x,x). you're using lists in strange way, i'm unsure purpose of code. anyway, think you're attempting code maplist , do getcardvaluelist(cards, values) :- maplist(getcardvalue, cards, values). if attempting this, can show 'amended' code: getcardvaluelist([],[]). getcardvaluelist([card|cards],[val|vals]):- getcardvalue(card,val), getcardvaluelist(cards,vals). no need append, list constructions done means of patterns in head'arguments. note should avoid redefine library predicates, append /3.

how to convert a string to a clojure expression? -

i'd send clojure expression in string evaluated @ receiver, might web service written in compojure. example, suppose have string "(* 7 6)", i'd turn '(* 7 6), can pass eval , 42. operation trivial in javascript, not quite sure how in clojure. hints? this should trick: (eval (read-string "(* 7 6)")) ;; 42 or, short: (load-string "(* 7 6)") ;; 42

bytearray - Convert byte array to short array in C# -

i'm reading file , wanted able convert array of bytes obtained file short array. how go doing this? one possibility using enumerable.select : byte[] bytes; var shorts = bytes.select(b => (short)b).toarray(); another use array.convertall : byte[] bytes; var shorts = array.convertall(bytes, b => (short)b);

javascript - How to "generate" unique variables? -

i'm working on google map, , want "generate" pins api. stuck, because pin looks this: var imagedriver = 'marker.png'; var driverlatlng = new google.maps.latlng(location.lat, location.lng); var drivermarker = new google.maps.marker({ position: driverlatlng, map: map, icon: imagedriver, title: drivers[0].name }); } i want create function of sort "generate" these variables prefix. check example below: var imagedriver0; var driverlatlng0; var drivermarker0; position: driverlatlng0, map: map, icon: imagedriver0, title: drivers[o].name these variables must unique of course don't "collide". have for-loop counts "drivers" inside api. somehow make for-loop create these pins? example: driversrealtime(); function driversrealtime() { setinterval(function () { var url = "http://blackcab.didair.se/api/drivers"; var lat; var lon; var name; var id; $.g

c# - Kinect Fusion get location -

so worked kinect fusion , 1 of cool things saw in videos , in research paper, can track/estimate kinect is. have tried find kind of way of doing it, misserably failed. does have experience this? i solved using worldtocamera matrix4. it can transform mesh spot correct camera coordinates.

javascript - how to make the title bar fixed -

Image
i want make title bar fixed(the bar containing profile,change password) , have created class ![when clicking on change password not take change password][1] p.pos_fixed { position:fixed; top:30px; right:5px; } not working meant , feel not good. here code of index.html <!doctype html> <!-- new doctype --> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>home</title> <link rel="stylesheet" type="text/css" href="styles.css" /> </head> <body> <section id="page" > <!-- defining #page section section tag --> <header> <!-- defining header section of page appropriate tag --> <hgroup> <h1>your logo</h1> <h3>and fancy slogan</h3>

java - What is 'Push Approach' and 'Pull Approach' to parsing? -

under push parsing approach, push parser generates synchronous events document parsed, , these events can processed application using callback handler model this text given in book pro xml development java sax 2.0. as stax, book says: under pull approach, events pulled xml document under control of application using parser. i want ask, meaning of highlighted text ? answer befitting beginner appreciated :) basically, push when parser says handler, "i have foo, it." pull when handler says parser, "give me next foo." push: if (mychar == '(') handler.handleopenparen(); // push open paren handler pull: token token = parser.next(); // pull next token parser

iphone - Reachbility in ios does not give callback when wifi access point switches -

i new ios. developing voip application. in application need callback when device ip address changes. have added reachability code in application. when go in wifi settings in iphone , cconnect wifi router other connected router. gives reachability callback. not give callback. why happen? code of reachability buggy? please tell me if doing wrong. in advance.

entity framework - Relationship field is not updated in Edit action (ASP.NET, EF5) -

i appreciate insight on this: following code [httppost] public actionresult edit(beamcollection beamcollection) { if (modelstate.isvalid) { beamcollection.beammaterial = db.types.find(convert.toint32(request.form.get("beammaterial_id"))); db.entry(beamcollection).state = entitystate.modified; db.savechanges(); return redirecttoaction("details", "bridge"); } return view(beamcollection); } when attempt modify beamcollection record, changes reflected , saved db except beamcollection.beammaterial takes selected value dropdownlist. when debug, can see selected value being assigned beamcollection.beammaterial! by way, field defined follows public virtual alltypes beammaterial { get; set; } so reflects 1 many relationship alltypes, unidirectional relationship. what kind of strange (to me), the same technique used create action , works: public

symfony - Pass variables to Twig Translator -

in messages.en.yml: variable_name: welcome %site_name% - %other_info% in twig {{ 'variable_name'|trans( -here- ) }} it's -here- part i'm struggling know how pass data in. must way (above example). maybe i'm misunderstanding question if understand correctly, need give array first parameter of trans filter. {{ 'variable_name'|trans({'%site_name%': 'my website'}) }} and of course, values can variables if don't put them between quotes : {{ 'variable_name'|trans({'%site_name%': 'my website', '%other_info%': page_name}) }}

jquery - Questions about Drupal and Ajax -

i have custom module, module generate table buttons. when button clicked load ajax form display in div. hook menu call function example /myapp/get_form. the problem comes when have save data of new generated div. created div save data ajax ( $form['submit'] = array('#ajax' => array(...))), new form not save data ajax, form post data /myapp/get_form, not behaviour need. so have 2 questions. how post data generated ajax in new form? would ok save data (node) jquery disabling submit , using ajax+json? thanks! you can use jquery .submit method prevent default submission beahvior , handle trought $.post notice fields/modules , #ajax stuff require additional javascripts included in full page load. to them should retrieve them $js_list = drupal_add_js() , add current page jquery (eg adding them tags in head of current page.) after scripts loaded call drupal.attachbeahviors() attach newly loaded javascript functionality new form.

c++ - Parallelization of nested loops with OpenMP -

i trying parallelize following loop in code openmp double pottemp,pot2body; pot2body=0.0; pottemp=0.0; #pragma omp parallel reduction(+:pot2body) private(pottemp) schedule(dynamic) for(int i=0;i<nc2;i++) { pottemp=ener2body[i]->calculatepot(ener2body[i]->m_mols); pot2body+=pottemp; } for function 'calculatepot', important loop inside function has been parallelized openmp cenergymulti::calculatepot(vector<cmolecule*> m_mols) { ... #pragma omp parallel reduction(+:dev) schedule(dynamic) (int = 0; < i_max; i++) { ... } } so seems parallelization involves nested loops. when removed parallelization of outmost loop, seems program runs faster 1 outmost loop parallelized. test performed on 8 cores. i think low efficiency of parallelization might related nested loops. suggests me using 'collapse' while parallelizing outmost loop. however, since there still betw

java - Parse broken HTML Sites with XPath -

this question has answer here: how “scan” website (or page) info, , bring program? 10 answers parse web site html java [duplicate] 3 answers i questions python here , tools found python, new question: need query things html site xpath. my current code looks this: url url = new url("http://somesite.com"); connection = (httpurlconnection) url.openconnection(); connection.connect(); document doc = documentbuilderfactory.newinstance().newdocumentbuilder() .parse(new inputsource(connection.getinputstream())); xpathfactory xpathfactory = xpathfactory.newinstance(); xpath xpath = xpathfactory.newxpath(); xpathexpression expr = xpath.compile("//span[@class='a-class']"); string price = (string) expr.evaluate(doc, xpa

javascript - How to save and display values from modal to view by database using codeigniter -

i new codeigniter , cant seem hold of problem, in short having problem understanding flow of data among codeigniter framework. want display data taken database using modals , display them in view.. the code in controller is: $unitdata =$this->clientunit->getblockunits($client_block_id); foreach ($unitdata->result() $row){ ($i=0; $i < 3; $i++) { $client_unit_name[$i] = $row->client_unit_name[$i]; $unit_owner_name[$i] = $row->unit_owner_name[$i]; } } $data['client_unit_name'] = $client_unit_name; $data['unit_owner_name'] = $unit_owner_name; $this->load->view('newblock_unit',$data); my modal file is: function getblockunits($client_block_id) { $query = $this->db->query('select * client_units client_block_id="'.$client_block_id.'"'); return $query; } as can see, modal , controller code, problem because of multiple rows returned, getting last row in outputs of view, not

actionscript 3 - Trying to remove all children, receiving error #1009 -

the idea setup have input text field , 3 separate buttons on stage. when type in text field , press input button, text inside field added array. when press display button contents of array displayed on screen (each value of array displayed underneath last value). the final button supposed remove current values on array, , clear displayed values on screen. cannot code work intended, since receive, typeerror: error #1009: cannot access property or method of null object reference. with block of code: import flash.text.textfield; import flash.events.mouseevent; var myarray:array = new array (""); var tf:tf; btninput.addeventlistener(mouseevent.click, txtinput); function txtinput(event:mouseevent):void {myarray.push(txtinput.text);} btndisplay.addeventlistener(mouseevent.click, txtdisplay); function txtdisplay(event:mouseevent):void {for (var i:int = 0; < myarray.length; i++) {var tf:tf = new tf(); tf.txt.text = myarray[i]; tf.y = 280 + (i * 25); tf.x = 265

Python post form with button javascript -

i try post ads in website. have 2 forms ,the first form ask me information of ads , ok submit them in second form, submit have button (input) javacript, onclick="action_cmd('delete')" i use mechanize , python . the code javascript : function action_cmd(action){ var hidden = document.getelementbyid("div_cmd"); hidden.innerhtml += "<>input type=\"hidden\" name=\"cmd\" value=\"" + action + "\">"; document.form_ads_action.submit(); } the code python : first form add information. br.open("link") br.select_form(nr=0) br.submit() is ok first. for second form: br.select_form(nr=0) br.submit() doesn't work. the code html : form name="ads_action" action="link" method="post" enctype="multipart/form-data"> input type="image" name="back" id="back" value="back" onclick="action_cmd(&

android - Release certificate with google maps V2 on google play -

i have implemented google maps v2 successfully.i have made debug described google map tutorial . time release app google maps on google play.for have make release certificate of google maps.and not understanding first step of release certificate fingerprint . from download keystore file? api console google where release certificate keystore file? it's keystore create signing applications. don't download anywhere. should not give anyone, not google. see http://developer.android.com/tools/publishing/app-signing.html#releasemode more information.

android - Proguard and HashMap<String, MyObject> -

i'm developing apis android library project , i'd export them obfuscated jar. i have various classes public entities are: myinterface : interface listing methods user have implement; myutilities : class static methods; mysingleton : singleton (implemented enum single instance); myobject : class implementing particular object need handle; i new obfuscation followed tutorials , read android/proguard docs. i created jar project , used in external application. obfuscated non-public classes (so every class apart above-mentioned) , still continue working. now problem: one of methods specifed in myinterface is public void getobject(hashmap<string, myobject>); before obfuscation user add implements myinterface activity/class , (auto) generate implementation of the interface methods, in particular: @override public void getobject(hashmap<string, myobject> hashmap){ // user implementation } after having obfuscated jar, when add implements my