Posts

Showing posts from March, 2015

python - i am getting error [ socket.gaierror :[Errno 11004] getaddrinfo failed] -

here code snippet: import socket,sys s = socket.socket(socket.af_inet,socket.sock_dgram) max = 65535 port = 6000 if sys.argv[1:]==['server']: s.bind(('127..0.0.1',port)) print 'listnening @ ',s.getsockname() while true: data ,address = s.recvfrom(max) s.sendto('your data %d bytes' %len(data),address) elif sys.argv[1:] == ['client']: print 'address before sending'.s.getsockname() s.sendto('this message ',('127.0.0.1',port)) print 'address after sending ',s.getsockname() data,address = s.recvfrom(max) print 'the server ',address,' says',repr(data) else: print >>sys.stderr, 'usage: udp_local.py server|client' i getting error [ socket.gaierror :[errno 11004] getaddrinfo failed] just replace line: s.bind(('127..0.0.1',port)) with this: s.bind(('127.0.0.1',port))

objective c - How to pause code execution while waiting for UIAlertView response? -

i have uialertview , need decide code run according user response (depends on button user presses yes/no) i've found solutions won't work me: to put rest of code in the -(void)alertview : (uialertview *)alertview clickedbuttonatindex : (nsinteger)buttonindex function thing alert doesn't run on every execution on occasions need code in original function makes solution impossible me. to use flag (clicked) indicates button pressed , use following line of code: while (!clicked) [[nsrunloop currentrunloop] rununtildate:[nsdate distantfuture]]; but when use can't press buttons on uialert, mean, not respond. i've found bit different solution claimed works him, original code in c# in obj-c be: while (!clicked) [[nsrunloop currentrunloop] rununtildate:[[nsdate date] datebyaddingtimeinterval:0.5]]; but in case same response problems. please me make 1 of solutions work or suggest one. thank you, alex the first case delegate of alertview easi

php - Saving files to server in Cocos2d Javascript Game -

i've been struggling while , gave on inpementing sort of savegame option client side cocos2d javascript game (structure based on tutorial http://www.raywenderlich.com/33028/how-to-make-a-cross-platform-game-with-cocos2d-javascript-tutorial-the-platforms .. thx ray .. ) i'm trying find way save xml files webserver while running game, firstly in browser (because seems straightforward way going) , later app can access same webserver. i have fair idea how generate xml array objects , realise php friend when comes writing xml file disk on server side. i've heard of pal ajax seems have contact details : ) my biggest problem @ moment ajax exampes have found use jquery. realise might simplify cross browser compatibility issues can't fiure out how add jquery functionality js in game (probably stupidly basic or impossible mess bindings, don't know). examples assume doing straight form browser script great. if jquery no go , have , example of how send xml d

sencha touch 2 - ST2.1 vs ST2.2 chart sprite style renderer -

with st2.1, had scatter graph renderer function changing sprite rotation , color based on values in store. working well. upgraded st2.2.0 , i'm having trouble rebuilding same function. code st2.1 - working. series: [ { type: 'scatter', xfield: 'local_date_time', yfield: 'wind_spd_kt', marker: { ... }, style: { renderer: function (target, sprite, index, storeitem) { var sweather = ext.getstore('sun'); if (index < sweather.getcount() ){ target.rotationrads = storeitem.data.sun_dir; if (storeitem.data.sun_spd_kt < 10) { target.f

mongodb - adding multiple same documents using addtoset command in mongoose -

my schema var userquizschema = mongoose.schema({ uid:{type:objectid,required: true,index:true}, answer:[{content:string, qid:objectid ,time:date }], }); in schema, 'uid' represents user identifier, while 'answer' array stores answers student had answered. in each answer, qid relates question id, , 'content' student's real answer, 'time' modified time stamp answer. here use mongoose upsert new answers array function updateanswer(uid,question_id,answer,callback){ var options = { new: false }; var quiz_id = mongoose.types.objectid(quiz_id); var qid = mongoose.types.objectid(question_id); userquizmodel.findoneandupdate({'uid':uid},{'$addtoset':{'answer':{'qid':qid, 'content':answer} } },options,function(err,ref){ if(err) { console.log('update '.red,err); callback(err, null); }else{ console.log('

location - User/Address association in Rails -

i'm working on first rails project , i'm trying create proper user/address (or rather user/location) association. thought problem common , others had done i'm trying , easy find answer wasn't case. there many different questions extremely different answers , couldn't figure out how things in case. here's scenario: the location can country, state/region or city, not more specific (i'm using google places library's autocomplete feature). avoid lot of duplicate information in users table every time 1 or more users live in same city (country, state, city, latitude, longitude etc), figured should have locations table. worse, user should have "home_location" , "current_location". associations: has_one at first thought: "well, user has address/location, should use has_one association. turns out if use user has_one location , location table 1 pointing user's table, not want, since many users should able reference same lo

Eclipse Android SVN Project with other library -

i have main project. project uses 2 projects(facebook sdk , google play services). 2 projects library. how can when import project libraries imported regardless of operating system? the answer simple. problem how libraries. fact relative paths in windows , mac os (unix) little bit different each other. put libraries in project , link them. file project.properties little changed , went this: android.library.reference.3=/holoeverywhere android.library.reference.1=/facebook android.library.reference.2=/google-play-services_lib

remove string in list in awt java -

in application should remove string list when running on thread,but got exception like, exception in thread "awt-eventqueue-0" java.lang.illegalargumentexception: item gh not found in list @ java.awt.list.remove(unknown source) @ org.sample.chatclient$updateclient$1.run(chatclient.java:200) @ java.awt.event.invocationevent.dispatch(unknown source) @ java.awt.eventqueue.dispatcheventimpl(unknown source) @ java.awt.eventqueue.access$000(unknown source) @ java.awt.eventqueue$3.run(unknown source) @ java.awt.eventqueue$3.run(unknown source) @ java.security.accesscontroller.doprivileged(native method) @ java.security.protectiondomain$1.dointersectionprivilege(unknown source) @ java.awt.eventqueue.dispatchevent(unknown source) @ java.awt.eventdispatchthread.pumponeeventforfilters(unknown source) @ java.awt.eventdispatchthread.pumpeventsforfilter(unknown source) @ java.awt.eventdispatchthread.pumpeventsforhierarchy(unknown s

C++ template method forward declaration -

i'm having little problem classes. have 2 classes both use template methods, therefore have put in header. here example. i'd compile without "forward declaration incomplete" problem. understand wrong can't figure how correct this. thank guys. class.h class a; class b; class { b *foo; template <class t> void func() { foo->fanc(); } } class b { *foo; void fanc(); template <class t> void osef() { foo->func<int>(); } } you have circular dependence. can not declare object of incomplete class. can solve declaring either pointers or references incomplete class. class { b* foo; or class { b& foo; on later case have initialize reference member initialization list of constructor. if using pointer should move definition of memeber function after definition of incomplt

php - No PostgreSQL link opened yet -

i completly new databases , trying make simple query postgresql database. problem don't understand how things work. in index.php $dbconn = pg_connect("host=myhost port=5432 dbname=mydbname user=myuser password=mypass sslmode=require options='--client_encoding=utf8'") or die('could not connect: ' . pg_last_error()); and connected database. when try query myphp.php $query = "insert public.account_recover_users values ($mykey,$email,$name)"; $result = pg_query($query); i error in title description. proper way connect database can access other files index.php well? p.s. $mykey,$email,$name 3 variables containing key (randomly-generated), email , name.

json - How can i cast LinkedHashTreeMap to string type? -

json data { "id": 8428514522228612, "name": "order acknowledgment", "columns": [ { "id": 7701511984703364, "index": 0, "title": "order#", "type": "text_number", "primary": true }, { "id": 2072012450490244, "index": 1, "title": "order date", "type": "date" } ] } creating java object , able getid value myjsonobject1 obj = gson.fromjson(line, myjsonobject1.class); system.out.println(obj.getid()); as columns object array , need loop through , columns key , pair values. need columns id,so trying below code singlemap nextactioninfomap = new gson().fromjson((string) col,singlemap.class); int column_id = nextactioninfomap.getid(); system.out.println(column_id); class myjsonobject1 { private string id; private string name; private obj

c++ - Fixed Decimal Precision -

this question has answer here: how can change precision of printing stl? 2 answers i using std::cout.precision(5); to set decimal precision of outputs. however, rather have output output 5 decimal places (right won't show 0's). how change code reflect this? you looking std::fixed std::setprecision . #include <iomanip> #include <iostream> double f =1.1; std::cout << std::fixed; std::cout << std::setprecision(5) << f << std::endl; stdout 1.10000

java - how to fix the order of the buttons in SWT? -

i have scroller 2 buttons how can set order of buttons in same raw , not each control : button scroller , button in different row fcomposite= new composite(composite, swt.right_to_left); griddata layoutdata= new griddata(swt.fill, swt.right_to_left, true, false); fcomposite.setlayoutdata(layoutdata); layout= new gridlayout(1, false); layout.marginheight= 0; layout.marginwidth= 0; layout.horizontalspacing= 0; layout.verticalspacing= 0; fcomposite.setlayout(layout); display display = parent.getdisplay(); shell shell = parent.getshell(); button button = new button(fcomposite, swt.left); button.settext("two"); //$non-nls-1$ button.setimage(display.getsystemimage(icon_1)); final scale scale = new scale (fcomposite, swt.border); rectangle clientarea = fcomposite.getclientarea (); scale.setbounds (clientarea.x, clientarea.y, 200, 64); scale.setmaximum (5); scale.setpageincrement (1); scal

How to keep an object in memory in Scala? -

is possible in scala create object , keep in memory? hope question doesn't exist yet. have not found scala specific @ least. the problem is, want read csv file of zip code data of country (it's not big, should fit memory) , store zip codes , corresponding cities object (e.g. map zip code key , citi(es) value). later want search specific zip code in object. if exists? , if want give out corresponding citi(es). don't want read in csv file again , again every time call function. that's why want keep data object in memory. there way in scala that? how can check if object exists in memory or if have create it? does has hint should for? after create map, remain in memory until garbage collected. if no objects reference map, garbage collector delete it. can either pass reference map around program never deleted, or make static. in java put static member in class - parallel in scala put in singleton object may this: object storeddata { lazy val data : m

map - Scala - diverging implicit expansion when using toMap -

i have following definition of enum: object graphtype extends enumeration { type type = value val message, request, errors = value } now trying map each of type corresponding, new timeseries follows: val datasets = ( graphtype.values map (graphtype => graphtype -> new timeseries(graphtype)) ).tomap the type system lists datasets map[graphtype.value, timeseries] precisely want. however, compilation fails error message: error: diverging implicit expansion type scala.collection.generic.canbuildfrom[ird.replay.gui.graphtype.valueset,(ird.replay.gui.graphtype.value, org.jfree.data.time.timeseries),that] starting method newcanbuildfrom in object sortedset val datasets = graphtype.values map (graphtype => graphtype -> new timeseries(graphtype)) tomap could provide explanation this, rather cryptic, error message? thanks try converting set of values enum list first so: val datasets = (graphtype.values.tolist.map(gt => (gt, new timeseries(gt)))).t

c# - How to pick up AppSettings from Web.Config into NavigateURL property on ASPX menu control? -

need pick appsettings key web.config navigateurl property on aspx menu control: applied follows : <asp:menuitem navigateurl="http://<%$appsettings:urlkey%>/index1.aspx" text="index page" value="index page"></asp:menuitem> where the above code not working! plz help you can't use server tags <%= ... %> syntax within asp.net server control element declaration. should set in codebehind instead. also runat="server" ? finally check out this answer might more.

sql - how to query a dataset in c# -

this first post, please gentle :) i'm working on automatic register university project. use rfid scanner scan student id tag , db created in access. use c# , datagridview show db tables. i trying write sql query return current sessionid each scanned tagid, compering date/time saved in db current date/time. question is: how do it? have googled problem not find answer looking (probably due complicated structure of tables). maybe able help. my tables structured followed: student fields name -> data type ========================= (pk) tagid -> number studentid -> text (fk) courseid -> number studentname -> text course ========================= (pk) courseid -> number coursename -> text coursemodule ========================= (fk) courseid -> number (fk) moduleid -> text module ========================= (pk) moduleid -> text coursename -> text modulesession ========================= (fk) moduleid -> text (fk) sessionid -> text sessi

command line - Ansible idempotent MySQL installation Playbook -

i want setup mysql server on aws, using ansible configuration management. using default ami amazon ( ami-3275ee5b ), uses yum package management. when playbook below executed, goes well. when run second time, task configure root credentials fails, because old password of mysql doesn't match anymore, since has been updated last time ran playbook. this makes playbook non-idempotent, don't like. want able run playbook many times want. - hosts: staging_mysql user: ec2-user sudo: yes tasks: - name: install mysql action: yum name=$item with_items: - mysql-python - mysql - mysql-server - name: start mysql service action: service name=mysqld state=started - name: configure root credentials action: command mysqladmin -u root -p $mysql_root_password what best way solve this, means make playbook idempotent? in advance! i posted on coderwall , i'll reproduce dennisjac's improvement in commen

hadoop - Cloudera Impala Queries failing -

i trying impala set on our cluster when try select count(*) our table following error. query: select count(*) events error: analysisexception: failed load metadata table: events caused by: tableloadingexception: failed load metadata table: events caused by: metaexception: javax.jdo.jdodatastoreexception: fetch of object "org.apache.hadoop.hive.metastore.model.mtable@3faf7a03" using statement "select `a0`.`db_id`,`b0`.`desc`,`b0`.`db_location_uri`,`b0`.`name`,`b0`.`db_id`,`a0`.`sd_id`,`c0`.`input_format`,`c0`.`is_compressed`,`c0`.`is_storedassubdirectories`,`c0`.`location`,`c0`.`num_buckets`,`c0`.`output_format`,`c0`.`sd_id`,`a0`.`view_expanded_text`,`a0`.`view_original_text` `tbls` `a0` left outer join `dbs` `b0` on `a0`.`db_id` = `b0`.`db_id` left outer join `sds` `c0` on `a0`.`sd_id` = `c0`.`sd_id` `a0`.`tbl_id` = ?" failed : unknown column 'c0.is_storedassubdirectories' in 'field list' nestedthrowables: com.mysql.jdbc.exceptions.jdbc4.mysql

javascript - remove parent tag <strong> from child tag <a> -

this question has answer here: how remove parent element , not child elements in javascript? 11 answers i want in javascript remove <strong> tag function: myfunc(this) <strong><a href="#" onclick="myfunc(this)">mylink</a></strong> i want clean code, <strong> tag needed removed this should that: function myfunc(node) { node.parentnode.parentnode.replacechild(node, node.parentnode); } the problem can run once, need additional check: function myfunc(node) { var parent = node.parentnode; if (parent.nodename === 'strong') { parent.parentnode.replacechild(node, parent); } } demo

mysql - Convert text Date to DateTime? -

in sent field ( varchar ) text formatted this: tue dec 04 16:10:05 gmt 2012 i convert datetime field type, solution in sql query? generally speaking, 1 uses str_to_date() tasks of sort. however, presence of timezone information in case presents problem str_to_date() cannot parse such strings. suggest first using substring_index() concat() extract data excluding timezone: select str_to_date( concat( substring_index(sent, ' ', 4), ' ', substring_index(sent, ' ', -1) ), '%a %b %d %t %y' ) my_table see on sqlfiddle . to convert data type of existing column: alter table my_table add column sent_timestamp timestamp after sent ; update my_table set sent_timestamp = str_to_date( concat( substring_index(sent, ' ', 4), ' ', substring_index(sent, ' ', -1) ), '%a %b %d %

c# - Custom control properties not reflecting in ASPX markup -

i'm having .net 4.0 solution several projects inside it. one project has custom controls implemented (say customcontrolproject ). the other project has aspx pages. (say webpagesproject ) one of custom control search textbox has properties. when add new property , build entire colution, still property doesn't appears in intellisense in aspx page. i checked dll reference taking exact dll customcontrolproject . it not hitting break point when attach custom control code w3wp.exe process. aspx pages hosted in (local) iis. i tried deleting entire stuffs in bin of custom control , build it, tried deleting dlls c:\windows\microsoft.net.. temporary internet files. checked version of both projects, same: <targetframeworkversion>v4.0</targetframeworkversion> the difference found in both project files this: <oldtoolsversion>3.5</oldtoolsversion> (for custom control project) <oldtoolsversion>4.0</oldtoolsversion> (for aspx pages

c++ - why this binary conversion does not work? -

#include<stdio.h> #include<conio.h> unsigned * bin(unsigned n) { unsigned a[16]; int = 0, j = 0; (i = 0; < 16; i++) { a[i] = n & 0x1; n = n >> 1; } return a; } void main() { unsigned n = 5; int = 0; unsigned * = bin(n); (i = 15; >= 0; i--) { printf("%d\n", (*(a + i))); } getch(); } please binary conversion not work. i'm trying calculate x^n using binary comversion. can anybode help?? you returning pointer local variable. variable stored on stack, , not valid after function returns. dereferencing pointer lead undefined behavior. the solution either make variable static , or pass in array argument function, or (as noted in comment james kanze) use type copies contents.

wpf - Unable to edit XAML Property, Yellow border in VS2012 -

im trying edit borderbrush ( edit: or indeed element requires color picker) in vs2012 properties pane. after selecting border element in mainwindow select brush > borderbrush >solid color brush in property pane. there yellow border around color picker , rgba values , im not able change in editor, can enter values fine mainwindow element xaml ie borderbrush="#ff777777" cant set them property editor! what can editor working? the solution have found date re-start vs2012.

Google Maps API V3 - Highlight a single road/street -

is there way highlight specified road or street using google maps api v3? here example of trying (image searching place in google): example styled maps not want since apply roads. polylines option finding coordinates can bit of pain since not complete. thanks. it has been discussed , i'm afraid you'll have use polylines. this might useful though : highlighting whole street maps api

regex - How to write reg expression which uses some special characters? -

i write reg expression should not use special symbols other (/, \, -, [, ], <, >, $, ~, !, @, #, :, %). try: if { [regexp {^[\w/-\[\]<>$#~!@#%:\\\/]+$} $name] != 1 } { puts "handle error"; } but not work. for example such name io1?? it's not treated error could help? you have escape - in character class or put @ beginning - otherwise it's interpreted range: regexp {^[\w/\-\[\]<>$#~!@#%:\\\/]+$} $name or regexp {^[-\w/\[\]<>$#~!@#%:\\\/]+$} $name the range between / , \[ seems contain ? .

java - Creating password protected ZIP file using TrueZip -

does know example creating password protected zip file using truezip? i followed the example given truezip example while extracting password protected zip file not accepting correct password set through java code. i found solution this try { final tconfig config = tconfig.get(); // request encryption in archive files. config.setoutputpreferences(config.getoutputpreferences() .or(bitfield.of(fsoutputoption.encrypt))); // configure archive detector custom key management zip files. config.setarchivedetector(newarchivedetector1("zip", "password")); // setup file paths. tfile src = new tfile("file1"); tfile dst = new tfile("file2"); if (dst.isarchive() || dst.isdirectory()) dst = new tfile(dst, src.getname()); // recursive copy. src.cp_rp(dst); } { // commit changes. tvfs.umount(); }

c# - Looking for more efficient software zoom -

i using c#, winforms application aforge library pull video usb camera , manipulate video. i doing using new frame event handler , posting image picturebox. far, has worked , done want. however, found out need add software zoom application. solution increase size of overall image , grab section of new, larger image, fit measurements needed. done on every new frame. int imagetopy; int imagetopx; rectangle rect; bitmap = new bitmap(bitmap, new size(bitmap.width * zoomtrackbar.value, bitmap.height * zoomtrackbar.value)); imagetopy = ((bitmap.height - height) / 2); imagetopx = ((bitmap.width - width) / 2); if (imagetopy != 0 && imagetopx != 0) rect = new rectangle(imagetopx, imagetopy, width, height); else rect = new rectangle(0, 0, width, height); bitmap = (bitmap)bitmap.clone(rect, bitmap.pixelformat) this need to. however, not @ efficient. when zoome

c# - How to access SharePoint files and folders from Win8? -

i developing win8 application interface sharepoint (i.e. open, close, update documents). how access sharepoint files win8, using win8 share contract or other method? you can use httpclient call rest servicrs exposed sharepoint , consume data. if want use csom need call csom functions dll , inclide dll in project. cannot include csom libraries directly in store app. csom: client side object model

javascript - How to hide URL bar on iPhone while using <meta name="apple-itunes-app" to put an ad for app at the top of the page? -

i have mobile web page want put ad ios app @ top of page using apple's meta tag this: <meta name="apple-itunes-app" content="app-id=myappstoreid, affiliate-data=myaffiliatedata, app-argument=myurl"> so added line html. opened web page on iphone , ad there, it's above top of page. the page uses window.scrollto(0,1) hide url bar on iphone, looks add positioned @ -50px, try window.scrollto(-50,1) ad there , it's not. if click (x) on ad, remembers not show ad again until clear cache. is there way know if ad showing? or not able hide url bar type of ad? thanks! try adding following apple-specific meta tags @ head of html document. <meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"> with above meta tags, don't think still need call window.scrollto(0,1) hide url bar refer documentation

Configuration PHPUnit with phpt -

i'm totally stucked. @ first code: file sample000.phpt --test-- basic test --description-- lowlevel basic test --file-- <?php echo 'hello world!'; ?> --expect-- hello world! file phpttestcase.php <?php require_once 'phpunit/extensions/phpttestcase.php'; class phpttestcase extends phpunit_extensions_phpttestcase { public $result; public function __construct( $file ) { $options = array( 'include_path' => 'd:\\xampp\\php' ); parent::__construct( $file, $options ); } } file phpttest.php <?php class phpttest extends phpunit_framework_testcase { public $object; public function setup() {} public function teardown() {} public function testall() { require_once 'phpttestcase.php'; $file = __dir__ . '/phpt-tests/sample000.phpt'; $phpt = new phpttestcase( $file ); $result = $phpt->run(); $this->asserttrue( $result->wa

java - New JFrame with TextArea -

i'm trying make new jframe contains textarea in java swing application. i've made jframe , assigned button making textarea inside new window speak seems bit more difficult imagined. app looks far: http://i.imgur.com/fyo3ggj.jpg here's code: public class userinterface extends jframe { private jpanel contentpane; private jtextfield brugernavn; string username = ""; string password = ""; private jpasswordfield adgangskode; /** * launch application. */ public static void main(string[] args) { eventqueue.invokelater(new runnable() { public void run() { try { userinterface frame = new userinterface(); frame.setvisible(true); } catch (exception e) { e.printstacktrace(); } } }); } /** * create frame. */ public userinterface() { setdefaultcloseoperation(jframe.exit_on_close); setbounds(100, 100, 600, 400); contentpane = new j

c# - Trouble setting a DataTrigger in WPF -

i have combobox , button on main view, , want apply style button such when combobox index set 1, button becomes visible (initially it's hidden). xaml code: <grid> <stackpanel orientation="vertical" margin="10"> <combobox name="combobox"/> <button name="mybtn" content="hello" visibility="hidden"> <button.style> <style targettype="{x:type button}"> <style.triggers> <datatrigger binding="{binding elementname=combobox, path=selectedindex}" value="1"> <setter property="visibility" value="visible"/> </datatrigger> </style.triggers> </style> </button.style> </button> </st

jquery - Why isn't ajax updating my text field on this form? -

i have "resend activation" form on site. visitor enters email address , resent original activation email. the problem is, if enter email address , click submit, enter different email address (i.e. mis-typed original email) still uses first input. here's code: // ***************************************************** // check form when trying resend activation // ***************************************************** $('#form-resend-activation').on('submit', function(e){ $('#formtitletext').text(ajax_login_object.loadingmessage); var error = false; // declare function variables - parent form, form url , regex checking email var emailreg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/; // start validation selecting inputs class "required" if($('#username').val() == ''){ $('#username').addclass('error'); $('#formtitletext').text("please enter em

c# - How to increase the height of DevExpress ComboBox droplist -

i displaying combo box facilities. there large number of facilities overall. show larger group of them. combo box has 10 , user has scroll more. how can show combo box larger group @ first? <td> <div> <dx:aspxlabel id="aspxlabel4" runat="server" text="facility:"> </dx:aspxlabel> <dx:aspxcombobox id="cbfacility" runat="server" valuetype="system.string" width="300px" enableviewstate="true" onselectedindexchanged="cbfacility_selectedindexchanged" autopostback="true" > </dx:aspxcombobox> </div> </td> </tr> have tried setting aspxcombobox.dropdownrows property larger 10? see q&a on @ devexpress http://www.devexpress.com/support/center/question/details/q353996 from answer ...you can manage drop-down window height using either aspxcombobox.dropdownheight or asp

java - Resltet does not return url params from post request -

i have post request: https://localhost/rest/myapi/1.0/mystatusupdate?usr=me&pwd=secret my request headers: user-agent: fiddler content-type: application/x-www-form-urlencoded host: localhost content-length: 67 i use resltet 1.1. (this version of resltet here several years on project. , not been changed yet) before, line of code returned me query parameters in url: requestbodyparams = request.getentityasform() urlparams = request.getresourceref().getqueryasform() requestbodyparams.size() = 0 if urlparams.size() > 0 i.e. can not any params requestbody if have some params passing in url. even if have params in request body, request.getentityasform() returns me emptiness if there params in url.. i wonder why? before worked. it might related tomcat (before tomcat6 , use tomcat7 ) another words: have follow rule: put everything url params , not use request body (request body empty) put everything request body , not use url params

c# - How to add a descriptive text to Html.ActionLink() url's -

given typical controller/action/id routing in mvc, looking add descriptive text url's of type mysite.com/home/page/myarg/the-title-of-the-page-etc. this similar they're of form stackoverflow.com/questions/928349234/the-text-of-the-question-etc. while can done with html.actionlink(linktext, "page", new { id = "myarg" } ) + "/" + myurltext looking existing extensions might available strip out non-alphanumeric characters etc. etc. before rolling out own you don't want append text actionlink that. can accomplish want routing. add new route global.asax registerroutes method, above default route, so: routes.maproute("page", "home/page/{id}/{title}", new { controller = "home", action = "page", id = urlparameter.optional, title = urlparameter.optional }); then set-up actionlink this: @html.actionlink("sometext", "page", new { controller = "h

mysql: slow query on indexed field -

the orders table has 2m records. there ~900k unique ship-to-id s. there index on ship_to_id ( field is int(8) ). the query below takes 10mn complete. i've run processlist has command = query , state = sending data . when run explain , existing index used, , possible_keys null . is there should speed query up? thanks. select ship_to_id customer_id orders group ship_to_id having sum( price_after_discount ) > 0 does not have useful index. try adding index on price_after_discount, , add condition this: where price_after_discount > 0 to minimize number of rows need sum can discard 0. also try running "top" command , @ io "wait" column while query running. if high, means query causes lot of disk i/o. can increase various memory buffers if have ram speed (if you're using innodb) or myisam done through filesystem cacheing. restarting server flush these caches. if not have enough ram (which shouldn't need 2m recor

AngularJS checkbox inside directive -

so have directive has checkbox in it. need make web service call when value of checkbox changed. how can value of checkbox when clicked? want checkbox confined scope of directive. mymodule.directive('test', function() { return { restrict: 'a', replace: true, scope:{}, template: '<div>'+ '<input type="checkbox" ng-click="toggleroomlock()" name="lockroom" value="lock" ng-model="lockroom">'+ '</div>', link: function(scope, element, attrs) { scope.toggleroomlock = function(){ //get value of checkbox here }; } } } i have tried getting value using scope.lockroom getting undefined. suggestions? the easiest way remove ng-click attribute template , put watch on model. change link function to: function (scope, element, attrs) {

python - Ordering of nested structures in PyTable table -

suppose have following pytable column descriptor: import numpy np import tables pt class date_t(pt.isdescription): year = pt.int32col(shape=(), dflt=2013, pos=0) month = pt.int32col(shape=(), dflt=1, pos=1) day = pt.int32col(shape=(), dflt=1, pos=2) class info(pt.isdescription): col1 = pt.int32col(shape=(), dflt=0, pos=0) startdate = date_t() birthdate = date_t() col2 = pt.int32col(shape=(), dflt=0, pos=3) enddate = date_t() col3 = pt.int32col(shape=(), dflt=0, pos=5) col4 = pt.int32col(shape=(), dflt=0, pos=6) how can specify position of 'startdate', 'birthdate', , 'enddate'? thought like: startdate = date_t(pos=1) birthdate = date_t(pos=2) and redefine date_t class as: class date_t(pt.isdescription): def __init__(self, pos): self._v_pos = pos year = pt.int32col(shape=(), dflt=2013, pos=0) month = pt.int32col(shape=(), dflt=1, pos

Mysql - Procedure - Error 1054 - Unknown column -

hello have procedure: begin declare myvar int; set @l_sql = concat('set @result = (insert ',p_table, '(sensor) values(123)'); prepare stmt1 @l_sql; execute stmt1 ; deallocate prepare stmt1; end when call call test(id_3174380747); i have error: 1054 - unknown column 'id_3174380747' in 'field list' which fault?

How do I resize an image with PHP using imagecopyresampled and then get the contents -

i'm resizing image , writing file. i've since had need store in amazon need contents of resized image. can done without first writing file? this current code looks like: $success = $src_img && @imagecopyresampled( $new_img, $src_img, $dst_x, $dst_y, 0, 0, $new_width, $new_height, $img_width, $img_height ) && imagejpeg($new_img, $new_file_path, $image_quality); // free memory (imagedestroy not delete files): @imagedestroy($src_img); @imagedestroy($new_img); $type = $this->get_file_type($new_file_path); $binary = file_get_contents($new_file_path); $image = $this->get_user_path() . $version . '/' . $file_name; $response = $this->s3->create_object(aws_s3_bucket, $image, array( 'body' => $binary, 'contenttype' => $type, 'acl' => amazons3::acl_public)); if ($response->isok()) {

tooltip on shiny R? -

i want have tool-tip in shiny r application. there easy way achieve that? now, creating density map , want simple tool-tip showing "click here slide through years" while hovering mouse on slider year. user interface: library(shiny) shinyui(pagewithsidebar( headerpanel("density map"), sidebarpanel( sliderinput("slider_year", "year:", min = 2001, max = 2011, value = 2009, format="####", locale="us" ) ) ), mainpanel( plotoutput("event_heatmap_map", width = "100%", height = "100%") ) )) server code: library(shiny) library(ggmap) library(ggplot2) mydata <- read.csv("/var/shiny-server/www/dmetrics.csv") shinyserver(function(input, output) { output$event_heatmap_map <- renderplot(width = "auto", height = 640,{ slice_year <- mydata[mydata$year==input$slider_year,] map <- get_map(c(l

How to show the video controls in jPlayer jQuery plugin? -

i have site have play video using jplayer without stop, play, volume, etc. controls. can show controls? options must change? dedicate few minutes on doc don't found example or nothing trivial (at least me ;) ) talk , don't want read doc ;) here doc have example , explanation newbie me, step 3 , 4. thing jplayer video controls div tags specific css class name image form controls graphicscss class attribute , div id must match jplayer instantiation parameter , hardcoded values.

Adding a strategy to a Zend\Form\Element\Collection -

is there way add hydration strategy zend\form\element\collection element? tried normal way: $hydrator = new classmethods(); $hydrator->addstrategy('language', new languagestrategy($em)); $hydrator->addstrategy('items', new unititemsstrategy($em)); $this->sethydrator($hydrator); with element: $this->add(array( 'type' => 'zend\form\element\collection', 'name' => 'items', 'options' => array( 'label' => 'items', 'count' => 1, 'should_create_template' => true, 'allow_add' => true, 'target_element' => array( 'type' => 'application\form\unititemfieldset', ), ), )); but hydrator strategy never gets called. when remap element text gets called. seems have element being zend\form\element\collection . actually, can added collections other eleme

io - Serial port com3 doesn't exist c# -

i have usb device plugged in serial port on com3. use open port: string[] ports = serialport.getportnames(); foreach (string portname in ports) { try { var port = new serialport(portname, 256000); port.open(); } catch(exception ex) { console.writeline(ex.message); } } i io exception here "port com3 not exist". use vs2012 + win7x64pro. tried reboot windows , worked fine, 1 time. days ago run project on vs2012 + win8 , great. worked great, no exceptions found. found great amount of similar questions there not solution problem. more information: usb device use bluegiga bled112 driver version "ble-1.1.1-71". explain me please , doing wrong. bluetooth creates phantom virtual serial ports can't opened. in worse scenario, paired, , driver spends minute looking not-present bluetooth accessory before failing open. other serial devices may not respond being opened no reason (opening change vol

java - How do I use our private key to make a web service call? -

we're using java 6, jboss 7.1.1 , spring 3.1.1.release. i'm trying write application request data wsdl on corporate web site , write data local database. our corporate group has asked public key of signed-by-authority client certificate (self-signed fine qa) of machine requesting data, saying use send ssl responses , should use our private key send requests them. i'm clueless how this. use jax-ws create client wsdl code , communicating web service, adding server's public certificate our trust store. in case, have no idea how tell web service client use requesting machine's private key encrypt data purposes of making wsdl request. grateful example code or other reference material pull off. - i have no idea how tell web service client use requesting machine's private key encrypt data purposes of making wsdl request. that doesn't make sense. there no such thing encrypting private key. decrypt it, public key being, err, public. let ho

asp.net mvc 4 - Path problems with running a sub application (umbraco) inside my MVC4 web application -

i have mvc4 web application, run locally @ mysite.local/. created application in iis 7, mapping mysite.local/corporatesite/. point application umbraco (cms) installation have locally. this works pretty well. i have these ui images , .css files in corporate site , linked-to absolute urls (examples: /css/mycss.css, /media/ui/myfunlogo.png, etc.). now "/" root has changed, if want css , images work, have use /corporatesite/cssmycss.css... logical. how can change configuration or sites setup or code don't have write whenever i'm linking file that. should use rewrite rules prepend application url? how people integrate these elements ? know lot go through subdomains, not ideal @ moment. thanks help! (i think question related 1 how integrate umbraco mvc4 in different aspects. , answers not me.) in umbracosettings.config, there setting "resolveurlsfromtextstring". setting true should tell umbraco add virtual directory name links , imag

PayPal-hosted JavaScript library for working with REST API? -

we’ve been using several styles of paypal integration on years , excited see introduction of new rest api. have been trying minimize our pci-dss compliance obligations, , our thought rest api allow communicate credit card information directly paypal (without having involve our servers) , while keeping users on our site, resulting in more seamless user experience. however, stumbling-block same-origin policies apply cross-domain ajax calls. we’ve noticed other payment processors typically offer javascript library can included directly site onto our page, allows javascript interact seamlessly payment processing network (circumventing same-origin restrictions). wondering if paypal has, or might offer, similar feature allow same style of integration new rest api? there way? note api integration requires http post calls, jsonp doesn't appear alternative. tried (twice) addressing paypal developer evangelist email address, have received no reply. thanks in advance. c

html - Multiple Backgrounds on Body -

not sure if possible can put 1 transparent image on standard background image on website. body { font-family: arial, helvetica, sans-serif; text-align: center; background: #133e6f url({{ site_img_dir }}/body-bg.gif) repeat-x; } this normal background image. want add transparent .png on 1 non-repeat image. how can done ? thanks to have multiple backgrounds on single element: .myclass { background: background1, background2, ..., backgroundn; } more complex example: 3 backgrounds other background properties: note1: can define background-repeat , background-position (and others background-size ) properties each of 3 backgrounds individually. .multi_bg_example { /* background 1, image */ background: url(img1), /* background 2, gradient */ linear-gradient(to right, rgba(255, 255, 255, 0), rgba(255, 255, 255, 1)), /* background 3, image */ url(img3); background-repeat: no-repeat, no-repeat, repeat; background-position: bottom right, lef

c++ - why do I need both constructor and assignment operator here? -

my code doesn't compile when 1 of these omitted. thought copy assignment operator required here in main() . constructor needed too? #include <iostream> #include <stdio.h> #include <string.h> using namespace std; class astring{ public: astring() { buf = 0; length = 0; } astring( const char*); void display() const {std::cout << buf << endl;} ~astring() {delete buf;} astring & operator=(const astring &other) { if (&other == this) return *this; length = other.length; delete buf; buf = new char[length+1]; strcpy(buf, other.buf); return *this; } private: int length; char* buf; }; astring::astring( const char *s ) { length = strlen(s); buf = new char[length + 1]; strcpy(buf,s); } int main(void) { astring first, second; second = first = "hello world"; // why construction here? ok, know : p first.display(); second.display(

C++ 2d array initialization -

the following line doesn't work: int n1=10,v1=10; int f[n1][v1]={}; error: variable-sized object ‘f’ may not initialized but line below works, why? const int n1=10,v1=10; int f[n1][v1]={}; array initializers need const. an int value can change const int value remain constant throughout entire program.

What are the side effects of using a large max_gram for an nGram tokenizer in elasticsearch? -

i want understand implications of using large setting max_gram when using ngram tokenizer. know explode size of index, what? make searches slower? cause things error out? etc it'll make searches slower sure, because lots of tokens generated comparison. in general, should analyze business , find out size of ngram suitable field. ex: product id, can support search ngram max 20 chars (max_gram=20), because people remember 5 or 6 chars of product id, 20 enough.

python - Django html input UnicodeEncodeError -

my django version 1.5a1 , python version: 3.2.3 i an unicodeencodeerror 'ascii' codec can't encode character '\xe3' in position 1: ordinal not in range(128) with html fragment: <input name="test" value="s&#227;o paulo" type="submit" /> my html: <!doctype html public "-//w3c//dtd html 4.01//en" "http://www.w3.org/tr/html4/strict.dtd"> <meta content="text/html; charset=utf-8" http-equiv="content-type"> i can't find why django converts html input ascii before creating instance of django.http.httprequest , giving python view.

ios - JSON Parsing Returns Null For Large Values Only -

i'll keep brief. i'm using code parse json local file array of objects: -(void)populatedata { nsstring* sourcepath = [[nsbundle mainbundle]pathforresource:@"ships" oftype:@"json"]; //get json string nsstring* jsondata = [[nsstring alloc] initwithcontentsoffile:sourcepath encoding:nsutf8stringencoding error:nil]; nsdata* data = [jsondata datausingencoding:nsutf8stringencoding]; //put json in array ships = [nsjsonserialization jsonobjectwithdata:data options:nsjsonreadingmutablecontainers error:nil]; nslog(@"%@", ships); } (note: showed 1 sake of brevity, there's ~20 entries in each one) this method works json formatted this: [ { "name": "santa maria", "operator": "kingdom of spain", "flag": "flag_spain" } ] it returns null json formatted this: [ { "name": "santa maria", "operator": "kingd

php - $_GET for MySQL query causing Unknown column error -

i have series of links pass information new page run mysql query. 1 of links source code: <a class="bloglink" href="parknews.php?tpf_news.park_id=5"> and code generates links: <a class="bloglink" href="parknews.php?tpf_news.park_id=<?php echo $row2['park_id'];?>"> <?php echo $row2['name']; ?> </a> the query uses info here: $park_id = $_get['tpf_news.park_id']; $sql = 'select headline, story, date_format(date, "%d-%m-%y") date, name tpf_news inner join tpf_parks on tpf_news.park_id = tpf_parks.park_id tpf_news.park_id = $park_id order date desc' ; this causes error display: error fetching news: sqlstate[42s22]: column not found: 1054 unknown column '$park_id' in 'where clause' i can't work out why not working. if in query replace where tpf_news.park_id = $park_id where tpf_news.park_id = 6 (or other number), works fine. any ideas?

excel vba - Stop Save File event by using another command button -

am new in vb. have excel file auto saving in intervals. want stop auto saving function using command button... plz me ... code ... private sub autosave_cmd_click() dtime = time + timevalue("00:00:05") 'set time per requirement with application .ontime dtime, "autosaveas" .enableevents = false .displayalerts = false thisworkbook.saveas "c:\<my file path>\auto_save_macro.xls" .enableevents = true application.enableevents = false end with end sub now question code stop auto save function through "stop_auto_save_cmd" command button? please me ... in advance ... private sub stop_auto_save_cmd_click() 'what code here? end sub your code snippet looks lot code found here - difference being think code @ link works, , yours doesn't. when describe how "working" code works, should able figure out why yours doesn't: public dtime date sub a