Posts

Showing posts from September, 2013

django - HTML variable inside of String -

i'm building website django. want have string url [already done], want string changeable based on variables. sudocode: variable = "hello" url = "www.facebook.com/a" ----> want "a" changeable, if changes, url goes different website. what best way this? thanks you should use saving groups in urls.py : from django.conf.urls import patterns, url urlpatterns = patterns('', url(r'^(?p<part>\w*)/$', 'my_app.views.my_view'), ) then, in my_view view string appear keyword argument: def my_view(request, part=none): print part hope helps.

sql server - TSQL DEFAULT CURRENT_TIMESTAMP -

i have following table create table t3 ( dd datetime default current_timestamp ) when start insert rows t3 via this: insert t3 select 1; i 1900-01-02 00:00:00.000 1900-01-02 00:00:00.000 1900-01-02 00:00:00.000 1900-01-02 00:00:00.000 why values in year 1900 ? i using sql server express 2012 . clock on machine current . your insert t3 without explicit column list expect source of values insert contains value every column in table except identity / rowversion or computed columns. your table has single such column , select statement source supplies 1 column. result inserting explicit integer value 1 column dd . that column's datatype datetime requiring implicit cast. result of select cast(1 datetime) 1900-01-02 hence results see. the legacy datetime datatypes allow implicit casts int , float , treat numeric values days since 1900-01-01 . newer datatypes such datetime2 not support these implicit cast , raise error instead. default constr

php - how to create a stored procedure in mysql the right way -

php mysqli quickguide stored procedures, http://php.net/manual/en/mysqli.quickstart.stored-procedures.php : if (!$mysqli->query("drop procedure if exists p") || !$mysqli->query("create procedure p(in id_val int) begin insert test(id) values(id_val); end;")) { echo "stored procedure creation failed: (" . $mysqli->errno . ") " . $mysqli->error; } does not delete procedure replace it? correct way it? point in deleting it? deleting not negate whole point of having procedure can call duration of mysql connection? you have drop 'old' procedure first, otherwise create fail "already exists" errors. it's same pretty every object in database, e.g. create table foo ... // creates table create table foo ... // **not** replace 1 created you cannot 'overwrite' table/proc/db redefining it. have drop original 1 first. consider chaos that'd occur if poor dba @ major bank accidentall

regex - How to delete all occurrences (0 or many) of a character between two strings in SAS -

i trying parse .json file sas. in order deal lists in .json file, remove commas between [item1, item2, item3, .... itemn], keep commas not within []. i think should able using prxchange regular expression...i can working 2 item list, can't figure out how alter work lists of different amounts. newvariable=prxchange('s/(\[\w+),(\w+\])/$1 $2',-1,oldvariable); examples: oldvariable = "{"hospital": "nop", "drugs": ["penicillin", "ampicillin", "cephalosporin"]}" newvariable = "{"hospital": "nop", "drugs": ["penicillin" "ampicillin" "cephalosporin"]}" oldvariable = "{"hospital": "kop", "drugs": ["tetracycline"]}" newvariable = "{"hospital": "kop", "drugs": ["tetracycline"]}"  maybe there better way approach this... so

Perl::Dancer how to include a file path as a parameter in the URI -

i'm new dancer framework , web apps in general. have dancer project in have route accepts multiple parameters. far, no sweat. however, if 1 of parameters has file path value route not found. i have tried encoding parameter string follows eliminate forward slashes: $paramstring =~ s/\//%2f/g; and encode slashes expected (i print out in log make sure). however, after parameter string appended base uri route i'm interested in, uri shows in browser in unencoded form, 404 error raised , log says unencoded route can't found. i looked request.pm module , found in init method private method called _url_decode called removes encoding. there way disable when not desired? i tried using uri_for method create uri. in case, encoded uri show in browser, however, route still not found , log indicates unencoded form (with forward slashes) being used search route trying match 'get /exome_proj_config/project_type=exome&project_root=/usr/local/projects/users/pdagosto

ios - iPhone - Can we tell if notification style is set to 'Banner' or 'Alerts' -

can application tell if notification style set 'banner' or 'alerts'? know can check 'none' because apple provides uiremotenotificationtypenone . others? no, seen in these 2 questions: is possible change default notification alert style upon application install? set default ios local notification style application .

c++ - Function that accepts every type of argument -

this question has answer here: c++ send type of argument function 3 answers let's want create function cout s value pass it, don't know whether int , or string , or…. so like: void print(info) { cout << info; } print(5); print("text"); you can function template: template <typename t> void print( const t& info) { std::cout << info ; }

c# - Using p4 api to submit individual files of changelist -

using p4v gui, can expand changelist, right click file in changelist, , submit file individually. using p4 api, functionality seem have ability submit whole changelist (using changelist.submit). there way submit particular file in changelist using p4 api? i realize there ways around this, such creating new changelist , using p4command "reopen" move file there , submitting changelist, feel there more succinct, quality way go this. thanks! under covers, p4v doing precisely describe: "creating new changelist , using p4command "reopen" move file there , submitting changelist". you can these steps using p4 command line or programmatic apis, overall process still same.

html - CSS styling for all cells in a table -

i want apply style cells (td elements) inside given table, , not other tables. there way in css without having specify class each td in table want apply style to? for example, let's want make cells in particular table have padding of 3px on 4 edges. every td declare: td { padding: 3px 3px 3px 3px; } problem: applies every single td on page. want apply single, named table, or alternatively, tables of given class. any ideas? #sometable td { padding: 3px 3px 3px 3px; } this apply style specific table .sometable td { padding: 3px 3px 3px 3px; } this apply change tables given class

vb.net - Inherited form does not show correctly in design view -

i have simple base form has no ui controls in design view. have declared few textbox controls have protected modifier , used in both parent code behind , ui controls in design view of sub class inherits parent class. basically see empty form in parent class's design view , form controls in sub class's design view. application compiles , runs expected. the problem keep getting a: "no context registered. use 'registercontext' method or 'spring/context' section configuration file" when try open form. know working week ago. did play around bit spring.net configurations sure have reverted back. if there problem show during runtime anyway. i debugged instance of vs see problem , shows issue spring.net not being able resolve basedao class. if let subclass inherit system.windows.forms only, there no issue opening the sub class in design view. strange. did manage create base class different name , subclass it. have tried deleting files solution ,

Find original Point within image after rotation c# -

below picture illustrates trying do. http://tinypic.com/r/nvbehh/5 i rotating image in c# (the white rectangle). problem need place green square (another image) on same point relative rectangle regardless of rotation. green square cannot rotated rectangle. as can see after rotation of white rectangle end different size canvas each time. i trying find exact point place green square after new rotated image created. ok below code rotates image , puts dot in correct place. issue if apply transformations in rotateimage method see of rectagle red dot in wrong spot. should stress need know point of dot not place in right spot. public class iconcontroller : controller { // // get: /icon/ public actionresult index() { return view(); } ////icon/icon?connected=true&heading=320&type=logo45 public actionresult icon(bool connected, float heading, string type) { var dir = server.mappath("/images"); //red sq

org mode - Omitting headings without properties from orgmode TaskJuggler export -

using org-mode 8.0.3 , taskjuggler 3. able mix notes taskjuggler information in org-mode file (in true literate programming style). (pseudocode): * project :taskjuggler_project: * task 1 :properties:... * subtask :properties:... * meeting notes * journal * task 2 :properties:... the sections without taskjuggler-specific properties (meeting notes , journal) still exported tjp file , appear in reports. i like: ideally, exclude meeting notes , journal tjp file if that's not possible, easy way hide them reports in taskjuggler report definitions. have report definitions in tji file. have tried setting :noexport: tag on headlines don't want exported? this prevent them exporting regardless of exporter type, although can remove tag when exporting format want content included (if ever so). see export settings , section on exclude tags more details.

jquery - Using a $.get value as a JSON object returns HierarchyRequestError: DOM Exception 3 -

i attempting grab json encoded value {"3":"su","4":"demo","5":"data provider"} via groups = $.get('actions/respond_groups.php'); however, when attempting use groups objects, so: function resetedit(){ groups = $.get('actions/respond_groups.php'); $('.edit-group').editable('actions/manage_users.php?method=edit-group', { data : groups, type : 'select', submit : 'ok' }); } however run into: uncaught error: hierarchyrequesterror: dom exception 3 jquery.min.js:2 (anonymous function) jquery.min.js:2 p.fn.extend.dommanip jquery.min.js:2 (anonymous function) jquery.min.js:2 p.extend.each jquery.min.js:2 p.fn.p.each jquery.min.js:2 p.fn.extend.dommanip jquery.min.js:2 p.fn.extend.append jquery.min.js:2 $.editable.types.select.content jquery.jeditable.js:506 (anonymous function) jquery.jeditable.js:239 p.event.dispatch jquery

jQuery Upload to S3 with PHP - Error -

i using jquery file upload plugin on wordpress site. modified of events, when file uploaded, value of hidden fields change, passed upon submission backend , creates custom post type in wordpress data. i went implement php script instead uploads files s3 bucket. works fine, except error in frontend, , won't complete task of updating hidden values full file urls. here script: $(function() { var url = '<?php echo plugins_url(); ?>/jquery-file-upload/server/php/', id = '#upload<?php echo $i; ?>'; $(id + ' .fileupload').fileupload({ url: url, datatype: 'json', <?php // images , pdfs if ($i == 1) { ?> acceptfiletypes: /(\.|\/)(gif|jpe?g|png|pdf)$/i, <?php // images } else { ?> acceptfiletypes: /(\.|\/)(gif|jpe?g|png)$/i, <?php } ?> maxfilesize: 5000000, disableimageresize: /androi

If Statement not work in template in django -

i've problem if statement in template using django , jade (pre-preprocessor). when submit form post , i've error, view return template values, work fine!! except following: select(id='id_{{ afiliado_form.tipo_identificacion.html_name }}', name='{{ afiliado_form.tipo_identificacion.html_name }}', class='span4') {% id, tipo in afiliado_form.tipo_identificacion.field.choices %} {% if afiliado_form.tipo_identificacion.value == id %} option(value='{{ id }}', selected='selected' ) {{ tipo }} {% else %} option(value='{{ id }}', ) {{ tipo }} {% endif %} {% endfor %} in afiliado_form.tipo_identificacion i've: (u'', u'---------') (1l, u'cedula de ciudadanía') (2l, u'nit') (3l, u'nn') (4l, u'pasaporte') (5l, u'cedula de extranjeria') (6l, u'tarjeta de identidad') (7l, u'nuip') (8l,

php - Error 500: Premature end of script headers -

i "premature end of script headers: contactform.cgi" error message when running below script. frustrates me ran .php on server , worked. however, had change servers , support cgi php. however, doesn't work. don't think code wrong, take in case. i've read around , have said it's permissions issue. case me? i know "display_errors" , "error_reporting" statements display errors in error log, if don't have access server, how can check logs? #!/usr/local/bin/php <?php print "content-type: text/html\n\n"; use cgi::carp qw(fatalstobrowser); ini_set('display_errors',1); error_reporting(e_all); if(isset($_post['email'])) { //email form me $email_to = "myemail@yahoo.com"; function died($error) { // error code can go here echo "oops... something's wrong. "; echo "fix error(s) below:<br /><br />"; echo $error."<br /><br />&

Jquery Zip code service area verification woes. -

i'm trying validate form takes in users zipcodes , tests against array of zip codes serviced. i'd make work on submit. right nothing , throws no errors.. i'm lost. i'm kind of new jquery not programming <doctype!> <html> <head> <script src="http://code.jquery.com/jquery-1.7.2.min.js"></script> <script> var zipcodearray = ["98001", "98002", "98003", "98004"]; $("#zipcode").live('keyup', function(){ var zipcode = $(this).val(); if(zipcode.length >4){ if($.inarray(zipcode, zipcodearray)){ //do nothing, or whatever want //we have return true here. }else{ alert("sorry. offer services western washington @ time."); } } }); </script> </head> <body> <div class="zipcode"> <form> <input id="zipcode" name="zipcode" /> <input type="submit&

Issue with function to generate letter combinations in c++ -

i trying create function output possible combinations of letters, alternating consonants , vowels. should output: consonant + vowel + consonant + vowel + consonant + vowel --or-- bababa... i have first 2 letters outputting correctly, i'm stuck on adding more. problem put loops after below. i'm cout-ing on console (for testing), once it's working i'm going output file later reference. void createword(char consonants[], char vowels[]) { //clength = 21, , vlength = 5, consonants[] cstring consonants, , vowels[] cstring vowels. int i, j; (i = 0; < clength; i++) { (j = 0; j<vlength; j++) { cout << consonants[i] << vowels[j] ; cout << endl; } } } like surprising number of "generate combinations" type of problems, can solved counting. start couple of strings convert numeric character representation: char const *consonants[] = "bcdfghjklmnpqrstvwxyz"; char const *vowels[] = &q

Laravel 4 passing a mixture of blade syntax and html to a view -

on annivesariescontroller: public function index() { $annivesaries = annivesary::where('year', '>', 2011)->take(1)->get(); $data = "{{{\$annivesary->title }}} annivesary held in {{{ \$annivesary->year }}}"; return view::make('annivesaries.index', compact('annivesaries')) ->with('user', auth::user()) ->with('data', $data); } on views/annivesaries/index.blade.php : @foreach ($annivesaries $annivesary) <tr> <td> {{ link_to_route('annivesaries.show', $data,array($annivesary->id)) }} </td> </tr> @endforeach but when access /annivessaries route: {{{$annivesary->title }}} annivesary held in {{{ $annivesary->year }}} while expect like: annivessary 1 held in 2011 please let me know how can point. what trying sending blade syntax view won&#

junit - cannot run android unit test if I set the shareduserId as "android.uid.system" -

i got problem when running test target package's shareduserid "android.uid.system" when type in shell adb shell instrument -w -e class com.lewa.security2.holder.clearanceholdertest com.lewa.dunit.test/android.test.instrumentationtestrunner it never return result. but when remove "android.uid.system", works can 1 me ? a unit test in android need run after kill application. applicaions shareduid android.uid.system cannot killed in way. so,you need force close application before run unit tests.

c++ - What is critical resources to a std::mutex object -

i new concurrency , having doubts in std::mutex . i've int a; , books telling me declare mutex amut; exclusive access on a. question how mutex object recognizing critical resources has protect ? mean variable? i've 2 variables int a,b; declare mutex abmut; abmut protect what??? both , b or or b??? a std::mutex not protect data @ all. mutex works this: when try lock mutex if mutex not locked, else wait until unlocked. when you're finished using mutex unlock it, else threads waiting forever. how protect things? consider following: #include <iostream> #include <future> #include <vector> struct example { static int shared_variable; static void incr_shared() { for(int = 0; < 100000; i++) { shared_variable++; } } }; int example::shared_variable = 0; int main() { std::vector<std::future<void> > handles; handles.reserve(10000); for(int = 0; < 10000; i++) {

node.js - Error starting foreman (Dotenv::FormatError) -

i'm trying node.js app start using foreman. run forman start command in projects root directory , keep getting following error: /users/hebime/.rvm/gems/ruby-1.9.3-p448/gems/dotenv-0.8.0/lib/dotenv/environment.rb:34:in `block in load': line "== project-ps config vars" doesn't match format (dotenv::formaterror) /users/hebime/.rvm/gems/ruby-1.9.3-p448/gems/dotenv-0.8.0/lib/dotenv/environment.rb:27:in `each' /users/hebime/.rvm/gems/ruby-1.9.3-p448/gems/dotenv-0.8.0/lib/dotenv/environment.rb:27:in `load' /users/hebime/.rvm/gems/ruby-1.9.3-p448/gems/dotenv-0.8.0/lib/dotenv/environment.rb:23:in `initialize' /users/hebime/.rvm/gems/ruby-1.9.3-p448/gems/foreman-0.63.0/lib/foreman/engine.rb:172:in `new' /users/hebime/.rvm/gems/ruby-1.9.3-p448/gems/foreman-0.63.0/lib/foreman/engine.rb:172:in `load_env' /users/hebime/.rvm/gems/ruby-1.9.3-p448/gems/foreman-0.63.0/lib/foreman/cli.rb:136:in `load_environment!' /users/hebime/.rvm/gems/ruby-1.9.3-p44

user interface - UI on different resolutions devices for BB10 -

i have developed static library bb10 provides ui capturing user credentials , authenticate credentials. i have used library in 1 of app. problem facing is, whenever run app in bb q10 device( resolutions 720*720 ) logo providing @ top of ui not visible. works fine when run app in z10( 768 x 1280 ). can suggest should such doesn't happens. you need provide 720x720 specific asset: logo or layout. basicaly, in assets folder, make 720x720 folder. if put content (with same name assets root folder content) inside of it, q10 load 1 in 720x720 folder instead of default one. change nothing on z10. see here complete explanation: http://developer.blackberry.com/cascades/documentation/ui/resolution/using_static_asset.html

c++ - Why can't I put namespace in parent class constructor call? -

so know doing wrong according purists, inheriting std::vector, wanted add specific functionality think has lot of sense child of vector. anyway, not main concern. i have class : class : public std::vector<std::vector<double>> { public: a(size_type n, const value_type& val); ... other moethods ... }; what don't understand is, in constructor, why : matrix::matrix(size_type n, const value_type& val): vector(n, val) { } work, while if put : matrix::matrix(size_type n, const value_type& val): std::vector(n, val) { } it won't compile ? (using gcc-4.8) don't have using namespace std declarations anywhere in code. why can't put namespace in parent class constructor call? you can, , should. need specify template parameters of base class: matrix::matrix(size_type n, const value_type& val): std::vector<std::vector<double>>(n, val) //

osx - zsh: how to autocomplete file names after python script name? -

Image
i've moved bash zsh . it's great terminal shell, i'm missing 1 property - file name completion non-standard executables. for example, if ls gives thread_pool_examples , thread_pools : then typing du , space , tab autocomplete common prefix thread_pool , nd click iterate on options: clicking enter pick highlighted item. the problem not work custom scripts. example, if run rmf - python executable in path - , click tab, no autocomplete options appear. any ideas how make zsh autocomplete filenames every executable? honestly, imo in shell configuration breaking things up. try doing verify it: zsh -f # starts new shell ignoring configuration autoload compinit compinit ./my-shell-script [tab] it completes files. default. fwiw, if want bind particular completer command/alias etc, can do compdef _jstack jstack # simple _files completion compdef _files my-local-python-script # restrict file extensions compdef '_files -g "*.(eps|ps|pd

Restkit + Core Data: Inserts duplicate values in a UITableView on every app launch -

following alexedge tutorial have encountered following behavior. can provide code requested since there many lines , i'm not sure look. basically, "works" in sense data loaded uitableview, after stopping , starting simulator, inserts new duplicate rows in each section. i figured have caching following above tutorial pretty closely , i've set identificationattributes identify unique records (wouldn't, example, adding attributes eliminate possibility i've not specified sufficiently unique key, debugging purposes?). i've tried changing cache name, setting nil, keeps inserting duplicates. every reset simulator start on clean slate. if matters, calling getobjectsatpath in viewdidload per tutorial. understanding of how restkit worked was okay because smart enough infer no updates necessary records same. edit i have set identificationattributes array of 2 integer attributes determine unique record. i have managedobjectcache : // seal deal [m

Exception when running a simple android facebook integration program using Parse -

i have made simple program facebook integration of android using "parse" have used following code showing exception code , logcat shown below: main.java package com.example.facbk; import com.facebook.android.asyncfacebookrunner; import com.facebook.android.facebook; import com.parse.logincallback; import com.parse.parse; import com.parse.parsefacebookutils; import com.parse.parseuser; import android.net.parseexception; import android.os.bundle; import android.provider.syncstatecontract.constants; import android.app.activity; import android.content.intent; import android.content.sharedpreferences; import android.util.log; import android.view.menu; import android.view.view; import android.view.view.onclicklistener; import android.widget.button; public class mainactivity extends activity { private static string app_id =" 454641867918042"; private facebook facebook; private asyncfacebookrunner masyncrunner; string filename = "androidsso_d

sql - Convert YYYYMMDD to Excel dd/mm/yy -

in this post gert grenander makes suggestion format date field 'yyyy-mm-dd hh:mm:ss'. how convert 'yyyymmdd' 'dd/mm/yy' in sql call using same method? select date2, digits(date2), (substr(digits(date2),7,2) concat '/' concat substr(digits(date2),5,2) concat '/' concat substr(digits(date2),3,2) ) mmddyy datesample gives: signed char data type digits ( date2 ) mmddyy ---------- ---------------- -------- 20130711 20130711 11/07/13 you'll need convert decimal value (date2) string via digits, use substr extract pieces need, use concat (or || ) reassemble them including delimiter want. if 'date' column character, can leave out conversion character. select date4, (substr(date4,7,2) concat '/' concat substr(date4,5,2) concat '/' concat substr(date4,3,2) ) mmddyy datesample

html5 - Using flip toggle switch i my not getting alert message when toogle is "off" or "on" -

using flip toggle switch not getting alert message when toogle "off" or "on" in jquery mobile plz me out in html5 <select name="toggleswitch1" id="toggleswitch1" data-theme="" data-role="slider"> <option value="off">off</option> <option value="on">on</option> </select> in script $(document).bind("pageinit", function () { $("#toggleswitch1").unbind('change').bind('change', function() { if ($("#toggleswitch1").val('off').slider('refresh')) { alert("off"); } else { alert("on"); } }); }); working example: http://jsfiddle.net/39dek/ $(document).on('pageinit', '#index', function(){ $(document).off('slidestop',"#toggleswitch1").on('slidestop', "#toggleswitch1" ,function

winapi - In Delphi 2010, the Click event processed despite the corresponding button being disabled -

consider following piece of code executed within onclick event of given button: procedure tform1.button1click(sender: tobject); begin button1.enabled := false; //line 1 application.processmessages; //line 2 sleep(3000); //line 3 button1.enabled := true; //line 4 release; //line 5 end; in delphi 2010, if after clicking button manage perform yet click on while execution busy in line 3, subsequent click event apparently stored in queue of commands, when release(line 5) procedure called, application attempt process it. consequently click event triggered once again. second time around, button component has been destroyed, hence "access violation" error get's raised. the whole concept of acknowledging second click system when respective button disabled not seem sound. explanations shady behavior? the system behaving designed, aware code going against sound design principles. use of sleep , process

regex - regexp all non-empty sequence of non-whitespace characters exept comma -

how split line list using regexp(all non-empty sequence of non-whitespace characters exept comma). have try: set list_ [regexp -inline -all {\s+\[,]} $line] but doesn't work. so example: such lines: name name2 x,y x,y x,y x,y x , y floating-point numbers result should be: name name2 x y x y x y x y if want use regexp , -inline , can use: % set list_ [regexp -inline -all -- {[^\s,]+} $line] name name2 x y x y x y x y [^\s,]+ matches non-space characters , non-commas.

math - Using Ruby's log with 2 Arguments -

i'm using ruby math.log function , passing 2 arguments , i'm getting sort of error that. puts math.log(10, 10) the error get: log': wrong number of arguments (2 1) (argumenterror) the docs that's how it's supposed work? http://www.ruby-doc.org/core-2.0/math.html#method-c-log i take bet , suggest using ruby 1.8.7 in math.log takes 1 argument.

java - SMTP mail code is working fine in Android ICS but not in Gingerbread? -

i have written code send mail through smtp, mail sent android ics devices, gingerbread device mail not sent. can go through code , me... firstly m calling sendmail() method of gmailoauthsender class. class gmailoauthsender { private session session; public smtptransport connecttosmtp(string host, int port, string useremail, string oauthtoken, boolean debug) throws exception { properties props = new properties(); props.put("mail.smtp.starttls.enable", "true"); props.put("mail.smtp.starttls.required", "true"); props.put("mail.smtp.sasl.enable", "false"); session = session.getinstance(props); session.setdebug(debug); final urlname unusedurlname = null; smtptransport transport = new smtptransport(session, unusedurlname); // if password non-null, smtp tries auth login. final string emptypassword = null;

Bind clicked-event to empty space/area in a div with jQuery -

i want have click-event in jquery tells when clicked on empty area/no content-area: i have divs classes: <div id="products-area"> <div class="products"> <div class="product"> <div class="image-wrapper"></div> <div class="handles"></div> </div> <div class="product"> <div class="image-wrapper"></div> <div class="handles"></div> </div> ¨ <!-- want have function tell when clicks on "empty area". here --> </div> </div> i've tried this: $("#products-area").on('click', '.products .product', function(){ //do when clicked on product }); $("#products-area").on('click', '.products', function(){ if (!$(this).hasclass()) { //this doesn't work //do when objec

Web Service Android Application : Cannot serialize 1.0 -

p.s : have looked @ similar questions haven't been able understand do. talk using marshal class, can't seem understand. i creating android application consume jax-ws . using ksoap-2 library same. i take inputs user in series of text fields , pass these onto webservice activity. here in oncreate method call web service after setting soap object : protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); // message intent intent intent = getintent(); bundle extras = intent.getextras(); string cropname = extras.getstring(androidwsclient.crop_name); float area = extras.getfloat(androidwsclient.area); similarly names of fertilizers , add them arraylist called fertilizerlist. 3 more values in similar manner. soapobject request = new soapobject(namespace, method_name); // add parameters soap object // cropname propertyinfo propinfo = new propertyinfo(); propinfo.name = "cropname";

asp.net - How to detect visitor country -

to detect visitor country see below code suggested in many forums, cant working. modglobal.resolvecountry.threeletterisoregionname on local machine correctly return computer retional settings region whereas on production server return usa. i guess because function return envoirement regional settings (ie servers regional setting), can confirm this? , if true, best practice detecting visitors country in asp.net? try this dictionary<string,string> objdic = new dictionary<string,string>(); foreach (cultureinfo objcultureinfo in cultureinfo.getcultures(culturetypes.specificcultures)) { regioninfo objregioninfo = new regioninfo(objcultureinfo.name); if (!objdic.containskey(objregioninfo.englishname)) { objdic.add(objregioninfo.englishname, objregioninfo.twoletterisoregionname.tolower()); } } var obj = objdic.orderby(p => p.key ); foreach (keyvaluepair<string,string> val in obj) { ddlcountries.items.add(new listitem(val.key, val.val

box api - How to get the file's MIME type for box.com v2 java api -

i trying integrate webapp box.com using (box api java v2) , need ability download selected files , folders box.com onto server. able this, not able file's mime-type box api. in application, store mime type of files. possible directly mime type of file using box java api v2? thanks, gala box doesn't expose mime types. can view list of available file object properties.

python - How to read multiline command line arguments into a python2 CSV reader -

i'm testing python 2 script takes csv file's text command line argument. csv standard excel csv file ',' delimiters items , presumably '\r\n' line endings. the problem need pass csv text single line script in order recognise string single argument. in order this, open csv in notepad , replace of new lines '\r\n' enables me read test script successfully. however, when try create csv.reader object string, csv.reader sees single line want iot see multiple lines. given following csv string example: the,quick,brown,fox\r\njumps,over,the,lazy,dog i expect following lines: the,quick,brown,fox jumps,over,the,lazy,dog but instead end single line: the,quick,brown,fox\r\njumps,over,the,lazy,dog once capture string command line, use following load csv.reader : input_str = self.getcsvstringfrominput() input_reader = csv.reader(stringio.stringio(input_str)) i'm using windows presumed \r\n correct don't seem using correct method.

json - .ajax call returns undefine in .net? -

i trying build vb.net web app using mongodb database. app needs consuming web service , return json string. used data source kendo ui chart. my web service:- imports mongodb.bson imports mongodb.driver imports mongodb.driver.builders imports system.web.services imports system.web.services.protocols imports system.web.script.services 'imports system.web.script.serialization imports system.componentmodel imports system.io imports ajaxcontroltoolkit ' allow web service called script, using asp.net ajax,'uncomment following line. <system.web.script.services.scriptservice()> _ <system.web.services.webservice(namespace:="http://tempuri.org/")> _ <system.web.services.webservicebinding(conformsto:=wsiprofiles.basicprofile1_1)> _ <global.microsoft.visualbasic.compilerservices.designergenerated()> _ public class webservice_bufferfile inherits system.web.services.webservice d

c# - wpf - why dont images display in the listbox even there are values of the images in code -

i need me problem experiencing with. have single listbox supposed display car detials (right side) , car image (left side) after retrieving them database. note: convert byte images database working fine. problem images dont display in listbox (left side) car details displayed. missing images! make sure car , carimage in wpf style binding. no idea have done wrong in code or wpf style. aprreciate if willing take @ codes problem. appreciated. thanks! wpf: <listbox style="{dynamicresource listboxstyle1}" displaymemberpath="car" x:name="listboxcars" /> wpf style - car information (right side) , car image (left side): <datatemplate x:key="templatelistboxitem"> <grid margin="5"> <grid.columndefinitions> <columndefinition width="auto"></columndefinition> <columndefinition width="*"></columndefinition> </grid.colu