Posts

Showing posts from June, 2011

java - Add a new class to an existing JAR File(which contains source code) -

i'll try illustrate problem simple can. i have jar file, extracted using winrar. (the jar file contains open source android library). want modify jar file adding new class library. so here steps: first, created class using eclipse , set package name same android's library package name. second, copied java file folder of other java files in library. third, tried compile java file via cmd using javac. the path of new java file , other .java , .class files of library is: c:\com\example\core\ name of new java file be: "mynewclass.java" command run via cmd is: javac c:\com\example\core\mynewclass.java but, during compilation many errors saying: cannot find symbols. i've been looking solution of problem couldn't figure how solve , make new jar file having class created seperately. what missing? as per earlier comments: rather trying modify jar, can access full source code of universal image loader library cloning repository using ...

Unfortunately, <App name> has stopped working. Android?Eclipse application -

i writting simple converter app, worked fine sometime on mobile when disconnected , reconnected laptop stopped working displaying above message. here's code: package com.example.myfirstapp; import android.os.bundle; import android.app.activity; import android.view.menu; import android.view.view; import android.view.view.onclicklistener; import android.widget.button; import android.widget.edittext; public class mainactivity extends activity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); final edittext editcentimeters = (edittext) findviewbyid(r.id.editcent); final edittext editinches = (edittext) findviewbyid(r.id.editinch); button buttonconvert = (button) findviewbyid(r.id.buttonconvert); buttonconvert.setonclicklistener(new onclicklistener() { @override public void onclick(view arg0) { ...

F# type confusion - I'm sure I'm getting the value I need but the compiler, at run time, does not agree -

i've got nice qc testing tool access via vb existing setup. tool give me strong typed access tables without making new classes etc. 1 of tables, sadly, uses commalist instead of child tables. this commalist causing me issues. code below, in theory, should split row.commalist , tell me if given number lies within. i able output value commalistvalues bit - it's bool. feed parameters given , compiler seems happy. why won't it, @ run time, use boolean criteria? i've got mental block guess - don't use f# routinely i'm wanting - unfortunately these niggles eat time. can help? edited requested. typical values commalist sample be:"234,132,554,6344,243,677" module quality_control open system open system.collections.generic open system.data open system.data.linq open microsoft.fsharp.data.typeproviders open microsoft.fsharp.linq type dbschema = sqldataconnection<"data source=someserver;initial catalog=sqldb;user id=sa;password=######...

java - explain this line of code android -

i beginner android, looking @ tutorial , came accross code: int temp = (sensor.gettype() == sensor.type_accelerometer) ? 1 : 0; can 1 explain me. may question duplicate, don't know search for. great if can tell me in c# aswell. (sensor.gettype() == sensor.type_accelerometer) ? 1 : 0; means int result; if (sensor.gettype() == sensor.type_accelerometer) result = 1; else result = 0;

c++ - TBB flow graph conditional execution -

it possible control execution path in tbb flow graph dynamically, using output of node condition variable determine whether node should launched? there couple ways dynamically control messages go in flow::graph: you can explicitly put messages other nodes in body of node. notice func_body puts message f1 or f2 , depending on value of input. nodes not attached make_edge() , because flow of messages not controlled topology of graph: template<typename t> struct func_body { typedef tbb::flow::function_node<t,t> target_node_type; target_node_type &my_n1; target_node_type &my_n2; func_body(target_node_type &node1, target_node_type &node2) : my_n1(node1), my_n2(node2) {} tbb::flow::continue_msg operator()(const t& in) { // computation bool send_to_one = in > 0; if(send_to_one) my_n1.try_put(in); else my_n2.try_put(in); return tbb::flow::continue_msg(); // message dis...

ruby - use nokogiri 1.5.9 with rails -

i want use ruby 1.8.7 rails, when run bundle install error: gem::installerror: nokogiri requires ruby version >= 1.9.2. error occurred while installing nokogiri (1.6.0), , bundler cannot continue. make sure `gem install nokogiri -v '1.6.0'` succeeds before bundling. nokogiri 1.6.0 not support ruby <1.9.2. i tried installing nokogiri 1.5.9 make things work did not help. i added line gem 'nokogiri', '~> 1.5.10' in gemfile , install nokogiri 1.5.10 , bundle install succeeded !

html - css list drop down menu bar moves when I zoom and resize browser window -

i created drop down menu bar in lists , css , anytime zoom in/out or adjust browser window size contents on bar shift left when zoom out , right when zoom in. also, when adjust browser window size navigational bar doesn't move rest of page left. if opens new browser window , it's smaller full screen, contents in navigation bar in wrong place (too far left or right). know how can fix this? thank in advance. did research previous questions similar mine seems time try solutions don't work me. here's link menu bar i've created. http://www.stlpublicradio.org/info/press-test.php# <code><div id="wrapper"> <ul id="nav"> <li> <a href="#">main menu 1</a> <ul> <li><a href="#">1</a></li> <li><a href="#">2</a></li> <li><a href="#">3</a></li...

vb.net - Dynamic method calling in VB without reflection -

Image
i want format numeric type using method call so: option infer on option strict off imports system.runtime.compilerservices namespace gpr module gprextensions <extension()> public function togprformattedstring(value) string ' use vb's dynamic dispatch assume value numeric dim d double = cdbl(value) dim s = d.tostring("n3") dim dynamicvalue = value.tostring("n3") return dynamicvalue end function end module end namespace now, various discussions around web ( vb.net equivalent c# 'dynamic' option strict on , dynamic keyword equivalent in vb.net? ), think code work when passed numeric type (double, decimal, int, etc). doesn't, can see in screenshot: i can explicitly convert argument double , .tostring("n3") works, calling on supposedly-dynamic value argument fails. however, can in c# following code (using linqpad). (note, compil...

javascript - How to make route redirect or send JSON back depending on accept headers? -

i want send json if user accesses route , accept headers allow json, , want redirect user page if user accesses route , accept headers not allow json. my solution hacky, involves inspecting req.headers.accept , seeing whether string contains json. if does, return json, else, redirect. there more optimal solution? you can try res.format method. res.format({ 'application/json': function(){ res.send({ message: 'hey' }); }, default: function(){ res.redirect('nojson.html'); } });

Send XML request and get response back -

i have been struggling easy question quite time. i trying post xml request website don't know start. software should used in first place? the xml frame described in doc ( http://profiles.catalyst.harvard.edu/docs/profilesrns_disambiguationengine.pdf ) my question more around type it? thanks romain this known rpc-xml request. making web requests formatted in way specified documentation. how proceed depends on language you'll using. in c#, you'd this: // create web request that'll post xml content web service string url = "http://profiles.catalyst.harvard.edu/services/getpmids/default.asp"; var request = (httpwebrequest)webrequest.create(url); request.method = "post"; request.contenttype = "text/xml"; // set content length based on data passing through // web call var data = encoding.utf8.getbytes("<generated xml here string>"); request.contentlength = data.length; // write data request stream before...

asp.net mvc - Issue when submitting a param into controller -

this cannot figure out while: in view wrote this: @using(html.beginform("pindex","home")){ <select name ="particalview"> <option value="1">option 1</option> <option value="2">option 2</option> </select> the controller behind is: [httppost] public actionresult pindex(string i) { if (i == "1") viewbag.page = 1; else if(i == "2") viewbag.page = 2; if(i == null) viewbag.page = 3; return view(); } whatever select, controller fails param of select list, can tell me missed? change parameter in pindex particalview [httppost] public actionresult pindex(string particalview) { if (particalview == "1") viewbag.page = 1; else if(particalview == "2") vi...

jQuery : Loading Text file using $.ajax -

i trying fetch data text file using jquery ajax. tried lot not figure out error. xhr.responsetext shows data in error success not show anything. var img_url = 'getimages.txt'; $.ajax({ type:"get", url: img_url, error: function(xhr, ajaxoptions, thrownerror) { alert(xhr.responsetext); }, success:function(data){ alert(data); } }); update : thrownerror shows contents of text file = error: invalid xml: amit.jpg|dharmendra.jpg|hangover.jpg|kungfu.jpg|matrix.jpg i think resolved problem providing datatype = "text" set datatype option of ajax object html , not try read xml. or set right content-type header in page or handler produces plain text value. default jquery "intelligent guess" content type.

linux - How to get started with Bluetooth for Ubuntu -

i need getting started. want make basic program (in c) can read bluetooth socket , print whatever sent. tried bluez (followed this: http://hackgnar.com/article/installing-the-latest-bluez-software-in-ubuntu-12/ went great until "make" @ end , no luck, not make , example program not find bluetooth/bluetooth.h). i guess hopeful options are: some 1 can tell me i'm missing bluez's install , possibly how started (compiling etc) alternative bluez? laptop bluetooth file transfers before installed bluez need application? any sort of comprehensive hello world (download, install, example, compile , run) i have strong programming background, not in linux (you can gloss on c stuff please not linux/ubuntu stuff). thanks! i can guess have old version of kernel, or 1 of required libraries. try updating linux installation (e.g. 3.5.x kernel or thereabouts). i had no problem completing steps took. if looking example programs, can @ simpler tools. on ub...

multithreading - C# Using a delegate to a member function to create a new thread -

i'd create new thread member function. use code, thread thread = new thread(new threadstart(c.dosomethingelse)); thread.start(); and it's working. i'd parameterize member function. i have class: class c1 { public void dosomething() {} public void dosomethingelse() {} public delegate void mydelegate(c1 c); } then have function in other class: public void myfunction(c1.mydelegate func) { c1 c = new c1(); func(c); // working // want called function runs in it's own thread // tried... thread thread = new thread(new threadstart( func(c) ); // compile wants thread.start(); // method name , not delegate } i call myfunction follows... myfunction( (c) => c.dosomething() ); so possible this. mean, can pass delegate und call object func(c). , can create new thread passing object.memberfunction. don't know how combine both, using memberfunction delegate , passing threadstart function. hints? ...

asp.net mvc 4 - MVC 4 and Razor 1 -

we upgrading existing site mvc 3 mvc 4 , far have encountered these 2 issues razor views : enter link description here , enter link description here our main interest in mvc 4 web api razor takes seat, there way configure mvc 4 use razor 1, question not tackle specific error configuring but: possible @ all? i believe should able register original razor view engine in global.asax.cs @ startup... , remove razor 2 view engine...

mysql - SQL Select with multiple search parameters using joins and subqueries -

i have spent hours searching answer problem without satisfying results. i want select 1 query players, villages , alliances -tables , date , population histories table. selection must filtered following rules: select latest information date. select if player has <= number of villages @ moment. select if total population of player's villages <= @ moment and 3. ones causing head hurt. how add query? here current query: select players.name player, players.uid uid, players.tid, villages.name village, villages.vid vid, villages.fid fid, alliances.name alliance, alliances.aid aid, sqrt( pow( least(abs($xcoord - villages.x), 400-abs($xcoord - villages.x)), 2 ) + pow( least(abs($ycoord - villages.y), 400-abs($ycoord - villages.y)), 2 ) ) distance histories left join players on players.uid = histories.uid left join villages on villages.vid...

json - Insufficient Scope Permissions -

i developing web application. in application post message on stocktwits wall. here getting error: insufficient scope permissions. tell me error is... my code is <form name="chart" method="post" action="https://api.stocktwits.com/api/2/messages/create.json?access_token=657c40d5a04615c973d474745f8f1311960dcc6d&'body=message'"> <a id="post">message posting</a> <input type="submit" value="post" /> </form> the token you're using doesn't have permission you're calling for. authentication docs

linux - FATAL: Module sg not found -

when installing uptime monitoring agent, got error messages: probing 'sg' devices fatal: module sg not found. but lsmod shows sg module loaded: # cat /etc/redhat-release red hat enterprise linux server release 6.1 (santiago) # uname -r 2.6.32-131.0.15.el6.x86_64 # cat /proc/scsi/sg/version 30534 3.5.34 [20061027] # find /lib/modules -name sg.ko /lib/modules/2.6.32-131.0.15.el6.x86_64/kernel/drivers/scsi/sg.ko # lsmod |grep sg sg 30186 0 # modprobe -lv|grep sg # # cat /boot/config-`uname -r` | grep config_chr_dev_sg config_chr_dev_sg=m following device , file system information: # pvs pv vg fmt attr psize pfree /dev/sda2 vg0 lvm2 a- 499.51g 113.51g # df -hf ext4 filesystem size used avail use% mounted on /dev/mapper/vg0-lv_root 99g 7.9g 86g 9% / /dev/sda1 485m 36m 425m 8% /boot /dev/mapper/vg0-lv_opt 99g 189m 94g ...

ios - UISegmentedControl selected tintColor on viewLoad -

i attempting set tintcolor , selected tintcolor uisegmentedcontrol. so far works fine except fact when view first loads, though call method set tintcolor (and executes) tintcolor doesnt set correctly until first click. it appear however, if something happening because trying set color black white selection, , default colors tad darker. any ideas on how modify colors load? //some code -(void)viewdidload _segmentedcontrol.selectedsegmentindex = 0; [self segmentedcontrol:_segmentedcontrol]; //set color method - (ibaction)segmentedcontrol:(basesegmentedcontrol *)sender { //change color of every subview(segment) have (int = 0; < [[sender subviews] count]; i++ ) { if ([[sender.subviews objectatindex:i]isselected] ) { [[sender.subviews objectatindex:i] settintcolor:nil]; [[sender.subviews objectatindex:i] settintcolor:[uicolor whitecolor]]; } else { [[sender.subviews objectatindex:i] settintcolor:nil]; [[sender.subviews ...

How to create a multi-dimensional array and have a property attached to a class determine where values are in the array? C# -

i'm trying create multidimensional array sort of 2d map text-based rpg game. want create multidimensional array that's, example, 5x5. array filled 0s represent space void of object. other numbers represent player on map, enemy , npc , skill-object (like enchantment table, etc.), doors link maps, , chests . have different values represent object there. if player tries walking chest , instead loot chest . chest reset 0 represent empty space, letting player walk there , representing there no more chest. if player tries walking on enemy , instead engage combat (handled separate class , functions). walking on number representing door link multidimensional array represents map. i want know kind of property need put inside player class handle on map. function change value move him around map. creating class map idea? store values objects there or in individual classes objects? how go this? thank help. reference, here's player class (careful, it's long...): pub...

python - Set wxPython widget font to external font file -

i'm developing application company trying brand particular font. they've given me .otf files fonts other products use. possible set font on widgets such buttons , static texts use these external files? if so, platform-independent? thanks not yet, possible soon. saw patch , discussion in wxwidgets trac.

java - Communication between imported library and main activity -

i'm using eclipse on mac develop android application. right have core application starting activities in imported library, need come activities in imported library core application. how can make activities in core application recognize imported library can navigate back? thanks that happening automatically. activity a starts activity b . activity b calls finish() leads activity a being in foreground again.

actionscript 3 - Flash+Node.JS+Socket.io stuck at handshake authorized -

i'm writing small game, socket-based obviously. works fine when in localhost, when i'm running .swf file dedicated server, , trying connect node.js server, connection getting stuck @ "handshake authorized": info: server starting... info - socket.io started info: listening on port 4000 info: server started. debug - client authorized info - handshake authorized _kqphvod6jyi-c1gr7zu and thats it. local swf file -> local node.js -> works. local swf file -> remote node.js -> works. remote swf file -> remote node.js -> doesn't work. node version 0.10.12. it's not firewall or antivirus. tried running on different ports. code example: //setup express serving crossdomain on same port game var express=require('express'); var app=express(); app.get("/crossdomain.xml", ongetcrossdomain); var server=require('http').server(app); //setup socket io var socketio=require('socket.io'); var io=soc...

asp.net - UrlReferrer return nothing -

my webpage has 1 button , 1 html <a> tag open same page. can urlreferrer clicking <a> tag. if clicked button, urlreferrer nothing. need know whether user clicked button have difference view . can me solve issue. there script on asp.net page btn.attributes("onclick") = "window.open('orderdetails.aspx?btnreservereleasedclicked=1&orderid=" & objorder.orderid & "','_self');return false" <a href="orderdetails.aspx?orderid=454057" class="body">orders</a> there no urlreferrer value because initial request in chain. in other words, did not redirect asp.net resource, asp.net came nowhere. since using query string in onclick attribute, append value tells orderdetails.aspx page control called (button or else).

Unit Testing an ASP.NET MVC Action Which Accesses the Bundles -

here's code in action method: var bundleurl = scripts.url("~/scripts/mybundle"); when try , unit test action method, following error/stack trace: system.argumentnullexception value cannot null. parameter name: httpcontext @ system.web.httpcontextwrapper..ctor(httpcontext httpcontext) @ system.web.optimization.scripts.url(string virtualpath) any ideas? i've mocked httpcontext appropriately, request filled, can access routes, etc. do need setup bundles? (like on global.asax) edit: after using ilspy @ source code system.web.optimization, appears scripts class creates httpcontextwrapper static httpcontext.current instance (which null). because scripts class uses static system.web.httpcontext.current instance, near impossible mock. so ended creating wrapper interface scripts, mocked out in unit tests. e.g var bundleurl = scripts ?? new scriptswrapper()..url("~/scripts/mybundle"); unit test: controller.scripts = new m...

Avoid repeated .click() in jQuery -

i have jquery script triggers click based on scroll position. want able click element again if user returns top of page contact form hide itself. problem creates loop. jquery(window).scroll(function (event) { var y = $(this).scrolltop(); if (y > 400) { $("#contactable-inner").click(); $("#contactable-inner").unbind('click');} }); you can go here see working on: http://algk.me update: $(window).scroll(function(){ var y = $("body").scrolltop(); var hidden = $('.hidden'); if (y >= 1000 && (hidden.hasclass('visible'))){ hidden.animate({"left":"-1000px"}, "slow").removeclass('visible'); } else { hidden.animate({"left":"0px"}, "slow").addclass('visible'); } }); any idea how work on scroll? what if used jquery's .show() ? in...

r - Dataframe consisting of factors vs real numbers -

i using bnlearn package, , error comes when run test error in check.data(x) : variables must either real numbers or factors. . dataframe, emg , contains 2 types of numeric values: 1) ~30000 columns of values, many of them being decimals (i believe these interpreted real numbers). 2) ~450000 columns of values either 0, 1, or 2. (i believe these interpreted factors). how can r believe values in class 2) real numbers, not factors. also, might approaching error wrong way. the data consists of 129 rows. example of data below. 9.758314 8.290852 0.03077250 0.353504 2 1 9.640181 8.581444 0.02144100 0.381118 0 0 8.898238 8.441256 0.01640670 0.574626 0 0 9.784328 8.406762 0.01525690 0.553795 1 1 11.017669 9.101037 0.01828330 0.489020 1 1 9.400396 8.073811 0.01897480 0.513596 0 0 in example, believe first 4 columns interpreted real numbers, while last 2 i...

ajax - Javascript Variable Showing undefined -

i have global javascript array , able call values @ beginning of function after that, when alert leaders[i], shows undefined: appears problem occurs when there 2 ajax calls nested in each other, js cannot seem find values in array. js function getleaders(bool) { var leaders = new array(); leaders.push('444'); leaders.push('111'); $.ajax({ url: 'url', crossdomain: true, type: 'post', data: { 'clubid': curclub }, success: function (data) { (var = 0; < leaders.length; i++) { alert(leaders[i]); <===== working fine here $.ajax({ url: 'someurl', crossdomain: true, type: 'post', data: { 'id': leaders[i] <====== works here }, ...

php - Suggest file extension from file type -

i have image file name without extension (lets assume image_file_name - note missing extension) , know file type (lets assume file type image/jpeg ). there php function returns file extension given type? explained in following pseudo code: $extension = get_extension('image/jpeg'); // return 'jpg' $file_name = 'image_file_name' . '.' . $extension; // result in $file_name = image_file_name.jpg please note image above example, file name of file type, such web page file name or else. , extension well, html, css ...etc. is possible above? , how? $ext = substr(image_type_to_extension(exif_imagetype('dev.png')), 1); //example png this give extension correctly , more reliable $_file['image']['type'] .

c# - Connection to database -

i trying create class can use within application connect database , run queries needed. found this post not quite working expect. here class: using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; using system.data.sqlclient; //a class returns connection database namespace epacube_utility_tool { public class epacube_db { public static sqlconnection getconnection() { string str = "user id=myusername;" + "password=mypassword;server=myserver;" + "database=mydatabase; " + "connection timeout=30"; sqlconnection con = new sqlconnection(str); con.open(); return con; } } } and here how trying use it: private void button1_click(object sender, eventargs e) { var connection = epacube_db.getconnection(); connection.open(); ...

d3.js - d3.time.scale() not working date inputs on IE 10 and Firefox -

i trying build bubble chart using d3.js. want bubble color filled according date. used following function generate color based on date given: color = d3.time.scale().domain([new date('2013-07-23'), new date('2013-06-01')]).range(['#98e698', '#1e7b1e']); and while creating graph calling it .style("fill", function(d) {return colour(new date("2013-07-8")); }); the above code working fine chrome. in ie 10 , firefox color function returning nan instead of colour code. why? return color(new date("2013-07-08")) with color spelled correctly , 0 in front of 8 works in ie10. reading new date(string) documentation , looks two digit month expected. in chrome: >new date("2013-07-8") mon jul 08 2013 00:00:00 gmt-0700 (pacific daylight time) in ie10: >new date("2013-07-8") invalid date >new date("2013-07-08") sun jul 7 17:00:00 pdt 2013 to fix problem - clean ...

If I remove the node.js log file, how to create one? -

i remove node.js log file this. cd /var/log rm node.log and create log file named "node.log", file not written node.js. how should do? thanks!! node continue write old (unlinked, not yet deleted, because still open) log file. easiest way restart node.

ruby on rails - How to "inherit" a class variable from ApplicationController -

i'm little new rails. say want like: def is_admin? @admin = user.grab(session[:username]).admin end i can define in applicationcontroller have call is_admin?() in every method in every subsequent controller. there way around not aware of? use :before_filter @ start of each controller: before_filter :is_admin at least don't have every method.

php - Member list omit Admin Account from List -

i working on website , have basic table display members of people have registered. don't want display admin account on table. there way exclude username/id table in case, admin? in advanced, josh here code member list table: <?php include("include/session.php"); /** * displayusers - displays users database table in * nicely formatted html table. */ function displayusers(){ $levels = array('1'=>'member','2'=>'supporter','3'=>'donor','4'=>'vip','5'=>'veteran','7'=>'co-founder','8'=>'founder','9'=>'admin'); //do_query //loop results $ulevel = mysql_result($result,$i,"userlevel"); $ulevel = $levels[$ulevel]; //continue loop global $database; $q = "select username,userlevel,email,timestamp " ."from ".tbl_users." order userlevel desc,use...

recursion - Time and space complexity of passing an array in Java -

suppose have recursive function works on balanced binary tree n nodes , height log(n) , call function below on root of tree. void printpaths(treenode root, int[] array, int depth){ if (root == null){ print array; } array[depth] = root.data; printpaths(root.left, array, depth + 1); printpaths(root.right, array, depth + 1); } array = new int[depthoftree] printpaths(root, array, 0); let array length log(n) (it store values along tree's paths). know recursion call stack max height log(n) . i'm unsure of how "pass-by-value" nature of java , java garbage collection come play affect time , space complexity. 1) time complexity of passing array recursive call? if java "pass-by-value," each recursive call take o(log(n)) copy array before starting function execution? 2) upper bound of how many of these array copies floating around in memory @ 1 time? inclination o(log(n)) . mean space complexity o(log(n)log(n)) ? i've re...

ruby on rails - When i run: heroku run rake db:migrate -

when pushing project heroku i'm using postgresql database, error: sorry went wrong. then run: heroku run rake db:migrate and these errors: heroku run rake db:migrate running `rake db:migrate` attached terminal... up, run.6196 deprecation warning: have rails 2.3-style plugins in vendor/plugins! support these plugins removed in rails 4.0. move them out , bundle them in gemfile, or fold them in app lib/myplugin/* , config/initializers/myplugin.rb. see release notes more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has- been-released. (called <top (required)> @ /app/rakefile:7) deprecation warning: have rails 2.3-style plugins in vendor/plugins! support these plugins removed in rails 4.0. move them out , bundle them in gemfile, or fold them in app lib/myplugin/* , config/initializers/myplugin.rb. see release notes more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released (called <top (require...

iphone - How to load url with "POST" type httpMethod in TTImageView? -

i using ttimageview loading images asynchronously in iphone. url image post type. how can load url post type httpmethod in ttimageview ? please. ttimageview doesn't support post method. should load image data using library afnetworking. , [uiimage imagewidthdata:data] uiimage , provide image view.

regex - Regular expression alternative for javascript escape() function -

i'm working on jmeter, , need send encoded parameter along http request. know can encoding of special characters using javascript escape(). can't use javascript here, i'm using jmeter's regular expression extractor. need regular expression pattern same escape(). please me. in advance. regular expressions can't this. escape() (which deprecated anyway , has been superseded encodeuri() ) takes ascii control characters , non-ascii characters , encodes them using %xx or %uxxxx hexadecimal notation. regular expressions can work existing text, not convert it.

rack - config.ru file for Rails 2.3.18 app -

does know contents of config.ru should rails 2.3.18 app in production run on passenger/unicorn/puma? so far i've got: # require environment file bootstrap rails require ::file.dirname(__file__) + '/config/environment' # dispatch request run actioncontroller::dispatcher.new but it's loading development instead of correct production environment. it turns out perfect config.ru . the real problem unicorn's -e parameter sets rack_env , rails 2.3.18 needs rails_env in order correctly detect environment. so, @ top of config/environment.rb , i've set env["rails_env"] ||= env["rack_env"] , working great.

Socket Buffer setting for JBoss 7 -

in jboss 5.1, there used setting called socketbuffer configure in server.xml inside jbossweb.sar i.e. jbossweb.sar\server.xml, looked this. <connector protocol="http/1.1" port="8080" address="${jboss.bind.address}" connectiontimeout="20000" redirectport="8443" socketbuffer="64000"/> does have idea corresponding setting in jboss 7 is? i suspect there no such parameter. don't find information how see it: connector defined in standolne.xml file in fragment: <subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host" native="false"> <connector name="http" protocol="http/1.1" scheme="http" socket-binding="http"/> <virtual-server name="default-host" enable-welcome-root="true"> <alias name="localhost"/> <alias name=...

php - $_POST is empty on XAMPP when post from remote form -

i have windows vps server, server personal server installed xampp running php , apache on server. now created post method on server , post data persoanl server (which have xampp). when use $_post variable empty, checked $_request variable empty too. local forms don't have problem , $_post pass posted variables, have problem in remote forms. i think problem related security , should change on php.ini , don't know should do! update: html code: <form method="post" action="http://xxx.xxx.xxx.xxx/login.php"> <input type="text" name="username" value="username ..." /> <br/> <input type="password" name="password" value="password ..." /> <br/> <br/> <input type="submit" name="submit" value="send" /> </form> php code : <?php echo $_post['username']; echo $_post['password']; pr...

sql server - why this sql query does not pass result accurately? -

i want sum(t1+t2) d result publish accurately group tblpersonalinfo.applicantid , query show me d's result group tblpersonalinfo.applicantid query show d's result incrementally. select distinct t1+t2, tblpersonalinfo.applicantid, tblpersonalinfo.applicantname ( select sum(tblexperange.score)as t2 tblexperience left outer join tblexperange on tblexperience.exprange=tblexperange.experange group tblexperience.applicantid ) tblexperience, ( select sum(tblgradpoint.score) t1 tblacademicinfo left outer join tblgradpoint on tblacademicinfo.cgpa=tblgradpoint.[cgpa/division] group tblacademicinfo.applicantid ) tblacademicinfo, tblpersonalinfo inner join tblcircular on tblpersonalinfo.cirname = tblcircular.cirname tblcircular.cirname=(tblpersonalinfo.cirname) return not 100% sure query sounds might need union 2 sub-queries one, can sum in select clause....

c# - What should I return when modelstate is invalid? -

i have partial view in layout file, partial view has form , server side validation. when form submitted , modelstate invalid should return? something bold here: 1) don't want use javascript 2) want show modelstat errors in client side thanks :) you should add @html.validationsummary() in place, want display errors

c# - Ilnumerics Ilpanel not activating when compiled in a winform into a dll when loaded into matlab -

Image
i want compile winform written in c# in visual-studio 2012 dll load matlab 2013a. using matlab .net interface want interact winform, listening events , passing data via set of predefined public methods. working on windows 7 ultimate sp2. this works surprisingly well, able interact native winform tools, buttons, trees, panels , charts. want use ilnumerics , particularly ilpanel used display "scenes" containing wonder of things. hit brick wall nothing ever gets rendered in ipanel when compiled dll , called matlab. ever shows default oval. i can attach matlab process in visual studio , run through code. executes fine. looks scene on line 32 not attached ilpanel1. any appreciated. form1.cs primary c# code without form1.designer.cs using system; using system.windows.forms; using ilnumerics; using ilnumerics.drawing.plotting; using ilnumerics.drawing; using markerstyle = ilnumerics.drawing.markerstyle; namespace windowsformsapplication3 { public partial class fo...

java.lang.ClassNotFoundException error -

i've reconfigured eclipse ide. and when run web application, got error it seems miss this jar , placed in lib folder of dynamic web application doesn't work. java.lang.classnotfoundexception: com.sun.istack.localization.localizable java.net.urlclassloader$1.run(unknown source) java.net.urlclassloader$1.run(unknown source) java.security.accesscontroller.doprivileged(native method) java.net.urlclassloader.findclass(unknown source) java.lang.classloader.loadclass(unknown source) java.lang.classloader.loadclass(unknown source) java.lang.classloader.defineclass1(native method) java.lang.classloader.defineclass(unknown source) java.security.secureclassloader.defineclass(unknown source) java.net.urlclassloader.defineclass(unknown source) java.net.urlclassloader.access$100(unknown source) java.net.urlclassloader$1.run(unknown source) java.net.urlclassloader$1.run(unknown source) java.security.accesscontroller.doprivileg...

c++ - How to prevent MFC dialog closing on Enter and Escape keys? -

i know 1 method of preventing mfc dialog closing when enter or esc keys pressed, i'd know more details of process , common alternative methods doing so. thanks in advance help. when user presses enter key in dialog 2 things can happen: the dialog has default control (see cdialog::setdefid() ). wm_command id of control sent dialog. the dialog not have default control. wm_command id = idok sent dialog. with first option, may happen default control has id equal idok. results same in second option. by default, class cdialog has handler wm_command(idok) call cdialog::onok() , virtual function, , default calls enddialog(idok) closes dialog. so, if want avoid dialog being closed, 1 of following. set default control other idok . set handler wm_command(idok) not call enddialog() . override cdialog::onok() , not call base implementation. about idcancel, similar there not equivalent setdefid() , esc key hardcoded. avoid dialog being closed: set han...

ruby - Selenium or Watir Webdriver, how to save resized screenshot? -

i try resized 400x400 screenshot of google. try both in selenium , watir no success. require 'watir-webdriver' b = watir::browser.new b.goto 'google.com' b.window.resize_to(400,400) b.driver.save_screenshot("screenshot.jpg") i screenshot original browser size. any idea how can save resized 400x400? at present, webdriver defines screenshot "full page screenshot". is, entire dom should represented image generated save_screenshot method. fact chrome driver doesn't generate screenshot of full dom bug in chrome driver . real answer there no way generate screenshot of browser view port using webdriver. having said that, might possible use other programmatic means accomplish this, depending on os. on windows, example, pretty easy desktop window's window handle (hwnd), capture image of desktop (using windows getdesktop , printwindow apis), , cropping using coordinates supplied webdriver window api .

scripting - How to debug a Lua script in Sublime Text 2 under Linux -

i using lua (i newbie on it) scripting under sublime text 2 , linux , debug script set breakpoints. how can achieve this? sublime text 2 text editor, not environment , cannot debug in it. don't script lua, not familiar tools available are out there .

Store encrypted https query strings in lieu of user credentials? -

i'm building app need store users' login credentials 3rd party service. communication 3rd party service done via https requests. from i've seen, looking @ posts this one , there's no clear answer best practices doing this, , specific methods discussed in post @ least leave desired. so 1 thought had perhaps it'd possible around problem "pre-encrypting" query string 3rd party request , storing encrypted data in db in lieu of storing users' credentials directly. way can store credentials in encrypted form not worry key being compromised, it's held 3rd party, not me. , if db compromised intruder wouldn't more obtain packet sniffing. i can't seem find examples of doing this, i'd feedback on whether community thinks it's reasonable approach. beyond that, little on how great. i'm building app in node.js/express, , i'm using https module handle communication 3rd party, i'd have go @ at lower level in order take approac...

javascript - inline CSS to align a social share icon -

Image
i'm using social share buttons on site sharethis. i'm having alignment issues facebook button. see screenshot. i'd direction on syntax incline css align or pad facebook line button aligns vertically others. tried many different combinations of doing including adding style="padding-bottom:25px" this html code provided sharethis: <span class='st_facebook_large' displaytext='facebook'></span> <span class='st_twitter_large' displaytext='tweet'></span> <span class='st_linkedin_large' displaytext='linkedin'></span> <span class='st_googleplus_large' displaytext='google +'></span> <span class='st_email_large' displaytext='email'></span> <span class='st_sharethis_large' displaytext='sharethis'></span> <span class='st_fblike_large' displaytext='facebook like'></span> ...

c# - Does Windows Azure support wcf duplex? -

i'm implementing wcf application (service) on windows azure notify client ( a wpf application, not silverlight ) have tried many ways authentication connection windows azure, such as: active directory azure: connect success azure authetication issuedtokenwstrustbinding not support duplex. wsdualhttpbinding: cannot connect azure because binding not authenticated . servicecredentials :authentication mode:windows, federation,usernamepassword :cannot connect azure because binding not authenticated . , have researched problem more 3 months ways couldn't successful. i want know, does windows azure support wcf duplex ?

iphone - AFNetworking freezes other actions -

i building chat application repeatedly calls web service using afnetworking . chat screen polls service new chat messages. related service works fine, ui keeps freezing , none of buttons working. here code: - (void)getallincomingmessages { nsurl *url = [nsurl urlwithstring:weatherurl]; nsurlrequest *request = [nsurlrequest requestwithurl:url]; afjsonrequestoperation *operation = [afjsonrequestoperation jsonrequestoperationwithrequest: request success:^(nsurlrequest *request, nshttpurlresponse *response, id json) { [self parsejson:(nsdictionary *)json]; [self getallincomingmessages]; } failure:^(nsurlrequest *request, nshttpurlresponse *response, nserror *error, id json) { ...