Posts

Showing posts from August, 2013

node.js - Passport.js not persisting on Firefox -

i using passport.js on node server local strategy, facebook , twitter. working great except 1 issue. on firefox, if close firefox , quit it, when reopen it, user logged on no longer logged in. not happen on other browsers. doing standard passport stuff , persisting session redis. wondering if else has had issue. again, working correctly on other browsers. please check cookie setting in browser...... i think setting this..... "clear cookies when browser close", if change , try...

continuous integration - Email commiter of a bad Perforce Changelist through Jenkins -

how can email commiter of broken change using perforce changelist number in jenkins? basically have cl available me, cant quite figure out how commiter name , other perforce metadata info based off of cl , send out email. you should install "email-ext" plugin jenkins. allows send editable email notification different build status. https://wiki.jenkins-ci.org/display/jenkins/email-ext+plugin captures content token , p4 meta-data, can configure (from "advance" option in jenkins, after plug-in installed) whom (committer, requester, recipient list, culprit etc) want send notification.

display image in tcltk window with R... How? -

can tell me how dislpay image in tcltk window ? i found img package here : sourceforge (1.3 version) can't install manually because of missing 'description' file. how can install ? -> how can display image on tcltk window (using img package or not) ? thank you config : windows 7 64 bits, r 3.0.1 you can use label this: w <- tktoplevel() tcl("image","create","photo", "imageid", file="your_image.gif") l <- ttklabel(w, image="imageid", compound="image") tkpack(l) this supports limited number of file formats though.

winforms - C# Winapp: TextBox is hidden by PictureBox -

i created shooting game, i've got problem end. player loses want show message him. i've tried messagebox, turned in center of screen. want kind of box says "you lost" in center of app. i've got pictureboxes on form , display textbox can't bee seen (only parts of it). any ideas? as said in comment, can use textboxname.bringtofront(); to bring control front, if want messagebox appear in middle, messagebox.show(this, "message"); should work believe messageboxes appear centered on parent default edit looked (messagebox centering) seems can centre 1 hooking seems little overkill

osx - Ruby ri tool will not work. -

i trying make use of ri tools , cannot them work. have tried rvm docs generate rvm docs generate-ri . neither have solved issue. on mac osx version 10.8.2. thanks $ ri string /users/zackwarburg/.rvm/gems/ree-1.8.7-2012.02/gems/rdoc-4.0.1/lib/rdoc/store.rb:546:in `load': undefined class/module encoding (argumenterror) /users/zackwarburg/.rvm/gems/ree-1.8.7-2012.02/gems/rdoc-4.0.1/lib/rdoc/store.rb:546:in `load_cache' /users/zackwarburg/.rvm/gems/ree-1.8.7-2012.02/gems/rdoc-4.0.1/lib/rdoc/store.rb:545:in `open' /users/zackwarburg/.rvm/gems/ree-1.8.7-2012.02/gems/rdoc-4.0.1/lib/rdoc/store.rb:545:in `load_cache' /users/zackwarburg/.rvm/gems/ree-1.8.7-2012.02/gems/rdoc-4.0.1/lib/rdoc/ri/driver.rb:384:in `initialize' /users/zackwarburg/.rvm/gems/ree-1.8.7-2012.02/gems/rdoc-4.0.1/lib/rdoc/ri/paths.rb:54:in `each' /users/zackwarburg/.rvm/gems/ree-1.8.7-2012.02/gems/rdoc-4.0.1/lib/rdoc/ri/driver.rb:378:in `initialize' /users/zackw

c++ - Design Pattern for an EEPROM burner -

i've built myself basic eeprom burner using teensy++ 2.0 pc bridge, , it's working great, expand compatibility, code getting rather hacky. i'm looking advice proper design making code expandable. i've taken class in software design patterns, awhile ago, , i'm drawing blank. basically, here's use case: i have several methods, such readbyte(), writebyte(), programbyte() (for flashroms require multi-byte write sequence in order program), erasechip(), etc. have eeprom pure virtual base class gets implemented concrete classes each chip type want support. tricky part determining chip type object generate. i'm using pseudo-terminal front-end on teensy++ serial input, basic command-line type interface parameters, send options chip type teensy++. question is, there design pattern (in c/c++), factory pattern, take string input of chip type (because that's i'm getting user), , return eeprom object of correct derived type, without having manually cre

forms - Passing a specific value for a hidden field using javascript -

i working on email preference center , user has 4 options - 3 options email frequency , last option unsubscribe. have 2 different fields form passing - email frequency , email status. i'm having trouble email status field. for radio buttons 1-3 want post email status ="i" , email frequency either "all", "weekly" or "monthly" for last radio button want post email status = "o" i can't seem both work - either passes , unsub radio button doesn't work or email status post o unsub null values buttons 1-3. below base code i'm working with. <input type="radio" name="email_frequency_status" value="w" id="email_frequency_status" >weekly <input type="radio" name="email_frequency_status" value="m" id="email_frequency_status"> monthly <input type="radio" name="email_frequency_status" value="a" i

ruby on rails - Why do I get an error when running bundle install? -

i spent past couple of hours, in addition scouring stack overflow, trying find solution problem, haven't been able solve when running bundle install . here error message: alexander-macbook-pro:healthapp alex$ bundle install fetching gem metadata https://rubygems.org/........ fetching gem metadata https://rubygems.org/.. resolving dependencies...... using rake (10.0.3) using i18n (0.6.4) using multi_json (1.6.1) using activesupport (3.2.11) using builder (3.0.4) using activemodel (3.2.11) using erubis (2.7.0) using journey (1.0.4) using rack (1.4.5) using rack-cache (1.2) using rack-test (0.6.2) using hike (1.2.1) using tilt (1.3.4) using sprockets (2.2.2) using actionpack (3.2.11) using mime-types (1.21) using polyglot (0.3.3) using treetop (1.4.12) using mail (2.4.4) using actionmailer (3.2.11) using arel (3.0.2) using tzinfo (0.3.36) using activerecord (3.2.11) using activeresource (3.2.11) using bcrypt-ruby (3.0.1) using sass (3.2.6) using boots

php - Generate an incremental $variable when in a for loop -

this question has answer here: how dynamically create variable name in php loop? 1 answer i'd increment variable within loop "$filename" turns "$filename1" , $filename2"? $filename = false; $filename1 = false; $filename2 = false; ($i = null; $i <=2; $i++){ $filename = $this->blabla; } use variable variables: ${"filename".$i} = $this->blabla; documentation

entity framework - EF not saving Unicode characters -

Image
i have table nvarchar column. when save data contains unicode characters column, ef sending data varchar manes unicode characters replaced. create table mytable (id int identity, name nvarchar(max)); i try set mytable.name "100 ≠ 200" , here's find in sql profiler: exec sp_executesql n'update [mytable] set [name] = @0 (([id] = @1)) ',n'@0 varchar(max) ,@1 int',@0='100 ? 200',@1=1 notice data type of @0 varchar(max) instead of nvarchar(max) . how fix this? update notice proper unicode character coming through in request. code pulling character our of model:

php - generate sha1 field for entity symfony2 -

my entity card has fields: id, code , token. 2 points: 1) need generate 'code' this: ... public function __construct(){ $date = new \datetime(); $year = $date->format('y'); $month = $date->format('m'); $this->codigo = $year . $month . ($this->id + 150); } but id return 0; try use lifecyclecallbacks. not works. 2) need generate 1 secure token 5 digits. this: $this->token = mt_rand(11111,99999); but how save in database (with sha1 encoder) , retrieve decrypted. i'm using symfony2.2. all objects card generated in administration. need populate database 2000 cards. thank all

(Codeigniter) Ion Auth CSRF Error:This form post did not pass our security checks (when loading views) -

i'm using ion auth authentication library in codeigniter. when load footer view, csrf error(this form post did not pass our security checks). when remove footer view, works fine though! there i'm doing wrong here? thanks! function edit_user($id) { //i'm posting last part of code of edit_user function in auth controller $this->load->view('layout/header'); $this->_render_page('auth/edit_user', $this->data); $this->load->view('layout/footer'); // i'm getting error when load footer view. } this code in views. <h1><?php echo lang('edit_user_heading');?></h1> <p><?php echo lang('edit_user_subheading');?></p> <div id="infomessage"><?php echo $message;?></div> <?php echo form_open(uri_string());?> <p> <?php echo lang('edit_user_fname_label', 'first_name');?> <br />

xcode - Managing separate in-development and usable copies of app -

i have app working on use in everyday life, it's being developed on, never chance use it. i cycle "ready" stage "developing" stage , , forth. there way can maintain 2 versions in xcode, 1 being "development", , other being "ready use", still using same code? this purpose of version managment software. using git (included in dev tools) or mercurial can branch code @ each release. allows continue development on new branch , restore stable version whenever needed. when new release stable, merge branch , create new development branch. make sure change bundle identifer of xcode projects in development branch can have both apps installed on device @ same time.

c# - DotNetZip - Cannot access a closed Stream -

none of similar questions quite i'm looking for! what's wrong following code? files text array of file contents, , filenames corresponding filename array. this code fails @ second-last line save method, can't see why stream closed! result = new memorystream(); using (zipfile zipfile = new zipfile()) { (int = 0; < files.count(); i++) { system.text.asciiencoding encoding = new system.text.asciiencoding(); byte[] bytes = encoding.getbytes(files[i]); using (memorystream fs = new memorystream(bytes)) { zipfile.addentry(filenames[i], fs); } } zipfile.save(result); } thanks - getting desperate here! this solution based on @spender's first comment, although solution posted below possibly nicer. try { result = new memorystream(); list<stream> streams = new list<stream>(); if (files.count > 0) { u

ruby on rails - Paymill pre-create card payment -

is there way pre-create card payment paymill? when creating paymill payment object need token, token got provide card info , amount/currency . first transaction of payment object, paymill require same ammount/currency value use token. user can't create payment future transaction because don't know how pay first transaction? thanks you in following way. create token amount/currency example 100 euro (but not smaller 1 euro!). afterwards make directly token preauth transaction. paymentobjectid response , creditcard checked if valid , has @ time wanted amount (limit not exceeded). preauth valid 7 days , afterwards deleted automatically or make reversal of preauth. paymentobjectid can make recurring payment different amount. best, christian

paypal ipn - PAY PAL IPN stop working -

my code stop working, have made changes $res=trim($res); saw in question still not working. code working including automatic post in facebook , tweeter. please, check code , me fix it? <?php // revision notes // 11/04/11 - changed post url https://www.paypal.com/cgi-bin/webscr https://ipnpb.paypal.com/cgi-bin/webscr // more info see below: // https://www.x.com/content/bulletin-ip-address-expansion-paypal-services // "action required: if using ipn (instant payment notification) order management , ipn listener script behind firewall uses acl (access control list) rules restrict outbound traffic limited number of ip addresses, may need 1 of following: // continue posting https://www.paypal.com perform ipn validation need update firewall acl allow outbound access *any* ip address servers host ipn script // or alternatively, need modify ipn script post ipns newly created url https://ipnpb.paypal.com using https (port 443) , update firewall acl rules allow outbound acces

java - unable to install jdk-7u25-linux-i586.rpm on Centos 6 - unpack200 error -

on centos 6, when do rpm -i jdk-7u25-linux-i586.rpm i dozens of messages like: /usr/java/jdk1.7.0_25/bin/unpack200: error while loading shared libraries: libgcc_s.so.1: cannot open shared object file: no such file or directory but when do: 'yum install libgcc' get: 'package libgcc-4.4.7-3.el6.x86_64 installed , latest version' i've tried other jdk packages, such 7.0_21 same result. should try next? sounds have 64-bit machine, , you're trying install 32-bit version of java. that, you'll need install libgcc.i686 package 32-bit runtime libraries. not sure why don't have them.

How To Create Splash Screen in FireFox Mobile App -

i want create splash screen firefox os app how can so. can 1 know how create 2 pages , call transition after time, example <div data-role="page" id="splash"> <div data-role="content"> <img src="images/splash.png" alt="startup image" style="width: 100%; height: 100%" /> </div> </div> <div data-role="page" id="home"> <div data-role="header" data-backbtn="false"> <h1>new page!!</h1> </div> <div data-role="content"> new content!<br/> test!! </div> </div> then use script changing pages $('#splash').on('pageshow', function(){ var hidesplash = function() { $.mobile.changepage($("#home")); }; settimeout(hidesplash, 2000); });

performance - Jerk in android animation when expanding a view -

i have been developing 1 application expand view property animation(using 9 old androids lib). , on animation end call set grid view's adapter. if remove set adapter part animation works fine. if add @ end of animation i'm getting jerk. why happens so? the jerkiness caused setting adapter (as have guessed). setting adapter not easy task , since you're presumably doing on ui thread jerkiness result. you can move setting of adapter thread allow animation continue smoothly while setting of adapter occurs asynchronously. see making listview scrolling smooth | android developers more information on moving heavy tasks thread main thread can focus on drawing ui.

jsf 2 - How to use if, else condition in jsf to display image -

i have condition have enrollment form in if userid 0 should show dummy image , when edit user update, check if userid not equal 0 display image corresponding userid. i used jstl inside jsf page. tries go else loop showing image. functionality working fine. thing can't display dummy image when visit page first. here s code.: <c:if test="${'#{user.userid}' == '0'}"> <a href="images/thumb_02.jpg" target="_blank" ></a> <img src="images/thumb_02.jpg" /> </c:if> <c:otherwise> <a href="/displayblobexample?userid=#{user.userid}" target="_blank"</a> <img src="/displayblobexample?userid=#{user.userid}" /> </c:otherwise> can use jstl tag or can using jsf? it illegal nest el expressions: should inline them. using jstl valid in situation. correcting mistake, you'll make code working: <c:if test="#{not empty user o

ruby on rails 3 - Accessing a url directly without login -

i considering doing - any url (excecpt disallow specifically) can accessed directly without signing-in, if click on of links on page, redirect sign-up page i thinking of several ways of doing it, neither flexible enough work devise create new link_to_not_registered helper use on every link_to , check if user logged in or not create before_filter check if user logged in. bit problematic, don't know how create filter when linking , not when directly accessing page have external flag test if user logged in , change page accordingly. neither way helps me redirect user after sign-in/sign (new helper links sign up, before filter becomes complex, flags simple) is there way create functionality of direct access show actions while clicking on links requires login? i think best approach before_filter. can check previous page request.referrer, if it's page inside app, redirect user signin path def to_signin redirect_to singin_path if request.referrer[&qu

php - json return null value after POST -

a.php $(document).ready(function() { $("#submit_form").on("click",function(){ var json_hist = <?php echo $json_history; ?>; $.ajax({ type: "post", url: "b.php", data: "hist_json="+json.stringify(json_hist), //contenttype: "application/json; charset=utf-8", datatype: "json", success: function(data){alert(data);}, failure: function(errmsg) { alert(errmsg); } }); }); }) b.php $obj=json_decode($_post["hist_json"]); var_dump($_post); if comment contenttype: "application/json; charset=utf-8" everything's works fine if uncomment this. var dump return null. when set contenttype in ajax, setting contenttype request not response. it fails json contenttype because data you're sending key/value formatted data (which missing e

jquery - Apply different colors to different items of a RadioButtonList -

i have radiobuttonlist like: <asp:radiobuttonlist id="rbl1" runat="server" repeatdirection="horizontal" repeatlayout="flow" selectedvalue='<%#bind("a1") %>'> <asp:listitem runat="server" text="1" value="1" class="radiobuttonlist"></asp:listitem> <asp:listitem runat="server" text="2" value="2" class="radiobuttonlist"></asp:listitem> <asp:listitem runat="server" text="3" value="3" class="radiobuttonlist"></asp:listitem> <asp:listitem runat="server" text="4" value="4" class="radiobuttonlist"></asp:listitem> <asp:listitem runat="server" text="5" value="5" class="radiobuttonlist"></asp:listitem> </asp:radiobuttonlist> i want apply red color

Worklight 6.0 - how to create and deploy dojo enable worklight hybrid application for android 2.2 using dojo 1.9 and worklight 6.0 -

i new both dojo , worklight , trying develope sample hybrid application using dojo toolkit. sample application works on simulators not works on avd using android environment 2.2.can please tell me steps/modifications follow create , deploy sample dojo enabled hybrid application? are hitting this? ibm worklight 6.0 - "could not find class 'android.webkit.webresourceresponse'" on android 2.2 it seems there limitation on android 2.2 support worklight 6.0.

JSON parse error on line 5 Expecting '}', ':', ',', ']' -

please help. have error in line 5 , not find it. { "_id": "_design/admin", "_rev": "23-99ab8890e8854137647859b56590a68c", "shows": { " les roles ": "function(doc,req) { return { body : [ "<h1>le", doc._id, "de" , doc.role, "</h1>"].join("");};}" } } you should escape quotes inside quotes \"

Remove rows from child tables using nhibernate nhsession -

i have mapping of feedbacksessions (parent table) , resultrows table (child table). need delete rows child table using nhsession. how delete rows child table , update parent table ? manytoone(x => x.resultrow, m => { m.column("resultrowid"); m.notnullable(false); m.foreignkey("fk_feedbacksessions_resultrows"); m.cascade(cascade.all); });

c# - (MVC4 - Razor) List of model in a model don't caught by the post method -

i have mvc application model : public class listofmymodel { public list<mymodel> mymodels { get; set; } public guid myid { get; set; } } public class mymodel { // code : public string mystring { get; set; } } and post method in controller : [httppost] public actionresult editme(listofmodel mylist) { try { if (modelstate.isvalid) { list<mymodel> mymodels = mylist.mymodels; foreach (mymodel model in mymodels) // code return redirecttoaction("index"); } catch { // code return view(mylist) } return view(mylist); } and view : ( use kendo ui ) ( p.s : code has been stripped away , replaced comment code ) @model myapplication.web.models.listofmymodel @{ viewbag.title = mytitle; layout = "~/views/shared/_mylayout.cshtml"; } <div class="span1"></div> <div class="span8"> &l

android - Cordova, Node.js, Phonegap -

i running through tutorial: http://docs.phonegap.com/en/2.9.0/guide_getting-started_android_index.md.html#android%20platform%20guide i created project within workspace with: cordova create hello2 com.example.hello2 "hello world 2" cd dir and now: cordova platform add android gives me following error: the command `android` failed. make sure have latest android sdk installed, , `android` command (inside tools/ folder) added path. output: /bin/sh: android: command not found my export path looks this: export path=${path}:/documents/devfolder/adt-bundle-mac-x86_64-20130522/sdk/platform-tools:/documents/devfolder/adt-bundle-mac-x86_64-20130522/sdk/tools what's wrong path ? or else cause error. and, yes did install android sdk. according this: http://developer.android.com/sdk/installing/bundle.html as stated in comments, problem related way path android executable defined. necessary define these paths absolute. as object has no method

php - Bug in chrome after photo upload -

Image
link http://invait.ru/collectivegift_template1.php browser chrome i following: 1) go on link http://invait.ru/collectivegift_template1.php 2) choose image 3) when showing image crop, click on without crop area and page scrolls down. tell me please how stop bug in chrome? code jscrop here p.s.: firefox doesn't have bug... p.p.s.: please if want click on downvote tell mme answer. think aboout problem 2 days... find part of code in jscrop.js: function watchkeys() //{{{ { if (options.keysupport) { $keymgr.show(); $keymgr.focus(); } } //}}} and remove line: $keymgr.focus(); it found on line 1238 in file. tell me if fixes things. this remove keys functionality. please take @ discussion: http://code.google.com/p/jcrop/issues/detail?id=39#c4 if need keys functionality, try changing fixed absolute on line 1224: var $keymgr = $('<input type="radio" />').css({ position: 'fi

WIX-Installer MSI Publisher Unknown -

how provide publisher name msi installer developed using wix installer? while installing .msi installer it's showing unknown publisher, how provide name publisher?is possible within wix? if kindly me how implement using wix installer. i think looking avoid security warning displayed when installs setup. need sign setup certificate , private key. can try following steps explained in following links: how digitally sign microsoft files signing .msi , .exe files everything need know authenticode code signing assuming looking publisher name in control panel programs , features . use manufacturer attribute in product tag. <product id="put-your-guid" manufacturer="publishername" name="productname" upgradecode="put-your-guid" version="1.0.0">

App design with Django and a reporting app -

i have 4 applicatiosn in 1 django site: people app car app holiday app report app i want produce reports/charts app 1,2,3 question this... 1) stick having report views in each app /people/report, car/report or 2) should put in report app report/car, report/people etc. the problem option 2 have lot of model importing, meaning never independent. in case see 3 options: has advantage it's easier change behaviour specific chart. i'm guessing people might have different types of chart cars. could made independent using generic foreign keys (or that). create separate report app automatically scans other apps charts.py app (or similar) django models.py . way can keep specific chart configuration in app contains it's model. the generic report app contain base class extend , override specific apps. my vote go option 3 since offers best both worlds. although might bit more complicated started, increases reusability.

Insert multiple images in using VB.Net -

i want make excel report multiple images using vb.net (not macro). i can use stored procedure list of data images names sql db . but don't know how use these images names , find specific images mapped drive using vb.net . finally, make images excel report. could illustrate samples inserting multiple images excel in using vb.net ? you can use reportviewer , image control. every report can converted excel using built-in functionality of reportviewer.

Magento cart regions restriction -

my client magento site cart restricted countries. there countries restriction in system > config > general panel, disablesthe whole website. site usable everyone, adding products cart , checkout restricted countries. i didn't find module doing yet. there 1 ? or should develop own module ? idea how ? greetings you have develop module , put observer on billing cart save before , check entered country restricted country or not if yes enter message

regex - Is Python re thread-safe? -

i tried googling gotten no authoritative answer. can confirm re module http://docs.python.org/2/library/re.html thread-safe? more specifically, functions , not? also, can reuse single global compiled re object sub , search , etc. safely across threads? seems there still no clear answer? ok, more specific example: class myclass: global_var = re.compile(...) def clean(self, value): return myclass.global_var.sub('', value) will work expected when multiple threads call clean @ same time? i don't think there is authoritative answer—other digging around in source, gets answers existing versions of python not future ones—since @ least parts of versions of regular expression module written in c (at least cpython; jython, instance, knows?) , nobody seems have made promises them. in practice have not seen bits of re code not thread-safe, , later example global_var.sub call "almost certainly" thread-safe. ... there'

Python Function returns wrong value -

periodslist = [] su = '0:' su = [] sun = [] sun = '' i'm formating timetables converting extendedperiods = ['0: 1200 - 1500', '0: 1800 - 2330', '2: 1200 - 1500', '2: 1800 - 2330', '3: 1200 - 1500', '3: 1800 - 2330', '4: 1200 - 1500', '4: 1800 - 2330', '5: 1200 - 1500', '5: 1800 - 2330', '6: 1200 - 1500', '6: 1800 - 2330'] into '1200 - 1500/1800 - 2330' su day identifier su, sun store values sun stores converted timetable for line in extendedperiods: if su in line: su.append(line) item in su: sun.append(item.replace(su, '', 1).strip()) sun = '/'.join([str(x) x in sun]) then tried write function apply "converter" other days.. def formatperiods(id, store1, store2, periodsday): line in extendedperiods: if id in line: store1.append(line)

Android webview working too slow with JQuery -

i using kendoui graphs in android application, graphs require lot of jquery loaded. android webview taking atleast 6 seconds draw graphs. there way can speed loading process. i have tried: websettings settings = web.getsettings(); settings.setjavascriptenabled(true); string data="html document kendo"; web.loaddatawithbaseurl("file:///android_asset/", data,"text/html", "utf-8", null); and have added: android:hardwareaccelerated="true" in manifest file. i not using internet in this. in advance

How to break nested foreach loop then go to parent foreach loop on c# -

i have following code: foreach(// condition here) { while (// condition here) { foreach (// condition here) { if (// condition again) { //do code } if (// condition again) { //stop first foreach go first foreach } } } } what want when hit 2nd if statement on last foreach loop return on first foreach loop. note: if 2nd if statement not true, should continue last foreach loop until condition not true. thanks in advance! the way directly goto . another (better) option restructure until problem goes away. instance putting inner code (while + foreach) in method , use return back.

css - Override ModelForm is_valid function -

i want provide forms nicer feedback using css. i'm doing it's clean code matter. have many modelforms , want of them behave in same way, thought there should way avoid duplicating code validation. i have created new class overrides modelform class modelformcss(forms.modelform): def is_valid(self): # run parent validation first valid = super(-->parentmodelform<--, self).is_valid() if not valid: f_name in self.errors: classes = self.fields[f_name].widget.attrs.get('class', '') if not "errors" in classes: classes += ' errors' self.fields[f_name].widget.attrs['class'] = classes return valid # return true my problem lies in runing parent validation since don't know how parent form... isn't there way self ? you've misunderstood how inheritance works in python. in su

android - Exception while reading file from SD Card -

i trying read xml file sd card. path fine, says: java.io.filenotfoundexception: /file:/mnt/sdcard/reginfo/output/data.xml (no such file or directory) here how attempting read file: fileinputstream file = new fileinputstream(new file("file://" + environment.getexternalstoragedirectory() + "/reginfo/output/data.xml")); i can see file in sdcard/reginfo/output folder in file explorer. remove "file://" path... fileinputstream file = new fileinputstream(new file(environment.getexternalstoragedirectory().getpath() + "/reginfo/output/data.xml")); only using environment.getexternalstoragedirectory().getpath() , sdcard directory. theres no need add "file://" before path.

sql - Error selecting rows where decimal > 0 -

Image
i keep getting error: msg 8114, level 16, state 5, line 1 error converting data type varchar numeric. when executing query: select a.emplid, a.empl_rcd, a.dz_presence_type, a.dz_date, a.dz_time_hours ps_dz_time_vw a.dz_presence_type in ('p50', 'forf') , a.dz_time_hours > 0 a.dz_time_hours decimal value, when execute query without 'and a.dz_time_hours > 0' query runs fine , returns values 0.00000 or 3.11400 . goal display values above 0. edit: forgot add exec sp_help ps_dz_time_vw tells me a.dz_time_hours decimal type length 5, prec 7 , scale 5. try forcing casting? (you may need specify length precision\scale etc) : cast(a.dz_time_hours decimal) > 0 just noticed collation. seems unfamiliar me. have affect different datatypes treated differently depending on local. decimal\varchar issues seems weird...

php - auto upload and set featured image to wordpress post based on external url -

i have music website based on soundcloud api , have custom post type called albums , each post track, @ moment can details need soundcloud track track image url. how can use url soundcloud , make wordpress download image , set post featured image? i have tried , searched on net , couldn't find nothing on how auto upload , publish external featured image. perfect! cheers! try extension wordpress: http://wordpress.org/plugins/wp-remote-thumbnail/ http://magnigenie.com/wp-remote-thumbnail-set-external-images-featured-image/

testing - How to get resource in tests using Gradle? -

i have: --src -----main -----test --------resources -------------test.zip in test directory have spock test. how can refer test.zip file pass absolute path test , check of methods? tried new file('.').absolutepath want find better solution def "check checktypezipmethod"() { expect: assert testedmethod(new file('.').absolutepath+"test/resources/test.zip")==true } you can either try locate zip file based on classloader#getresource , or configure test task set system property pointing zip file. latter easier implement, harder make work in environments other gradle (e.g. when running test inside ide). ps: in spock expect: or then: block, can (and should) omit assert keyword.

Android app for exclusive group -

i'm developing android app. customer offer through market restrict usage closed group of users. allowing use app people decide allow. how go it? emailing apk may not best causes problems phone settings, updates , can still forwarded person outside closed group. any suggestions appreciated.

c++ - Read file from position (to position) -

file-stream/ifstreamreadbufferandseekfileposition.htm">http://www.java2s.com/tutorial/cpp/0240_file-stream/ifstreamreadbufferandseekfileposition.htm this page able print content of file twice using file.seekg(0); so assume seekg(0) puts "cursor" (in java) beginning of file, , web site: http://www.cplusplus.com/doc/tutorial/files/ confirms me. but when file contains (0\n0\n0\n): while(getline(file,line)) { cclog(line.c_str()); cclog("%d",(int)file.tellg()); } file.seekg(0); cclog("%d",(int)file.tellg()); while(getline(file,line)) { cclog(line.c_str()); } (i'm doing in cocos2dx 2.2.2 way) it prints: 0 2 0 4 0 6 -1 i don't know i'm doing wrong. please help the reason behaviour seeing that, once read end of file, eof() state flag set. attempt read or position file after trigger error. error resulting in return code of error, -1. you can reset state flags (all of them) using clear(). code shoul

Fetch array mysql database php -

i trying fetch data database, not working. this code: <?php $koppla = mysql_connect("localhost","admin","","test"); // check connection if (mysqli_connect_errno()) { echo "failed connect mysql: " . mysqli_connect_error(); } $get = mysql_query($koppla,select * 123); while ($test = mysql_fetch_array($get)) { echo $test['tid']; } mysql_close($koppla); ?> `<?php $koppla = mysql_connect("localhost","admin","","test"); // check connection if (mysqli_connect_errno()) { echo "failed connect mysql: " . mysqli_connect_error(); } $get = mysql_query($koppla,select * 123); while ($test = mysql_fetch_array($get)) { echo $test['tid']; } mysql_close($koppla); ?> i getting following error while trying fetch array mysql database. wrong? parse error: syntax error, unexpected '123' (t_lnumber) in c:\wamp\www\test

C++ - issue while porting C++ code from Visual Studio to Linux Eclipse IDE -

i have project build in microsoft visual studio , want port in linux(opensuse 12.2) using eclipse ide. the project using opencv , have managed build opencv in linux. not huge, contains 3 .cpp files , 4 .h files defines classes used in project , 1 of .cpp files contains main() function. however, there 1 additional instances.inc file following content: #include "graph.h" #ifdef _msc_ver #pragma warning(disable: 4661) #endif // instantiations: <captype, tcaptype, flowtype> // important: // flowtype should 'larger' tcaptype // tcaptype should 'larger' captype template class graph<int,int,int>; template class graph<short,int,int>; template class graph<float,float,float>; template class graph<double,double,double>; where graph.h contains declaration of graph class. i changed extension of instances.inc file instances.h file. however, when try build project receive following error: ../src/branchandmincut.cpp

windows phone 8 - Radio controls not showing in WebBrowser -

i have link opens html page has radio buttons , other controls in it. opens fine , shows page contents when open in default browser. however, when try open same using webbrowser.navigate() , page opens doesn't show radio buttons present. strange . has else encountere these kinds of issues. kindly help. the html didn't have doctype declaration. declared doctype , shows fine. same html page without dtd shows fine on android , ios. somehow ie requires dtd.

How to get a IEnumerable<class> from c# in JavaScript -

in c# have 1 method public ienumerable<office> pointoffices; private void preparemap(ienumerable<office> tdmaps) { var pointoffices = tdmaps office[] ?? tdmaps.toarray(); if (tdmaps == null || !pointoffices.any()) return; pointoffices = pointoffices; } in javascript want each element of office , generate different html attributes of office class i tried var pointoffices =<%= pointoffices %>; but gives me error: unexpected token ] do need serialise class or method in js ? how can realize this? do need serialise class or method in js? yep! check out json.net . so in example should able this public string serializedpointoffices { { return jsonconvert.serializeobject(this.pointoffices); } }

linux - what is the meaning of delimiter in cut and why in this command it is sorting twice? -

i trying find reason of command , know basic found that last | cut -d" " -f 1 | sort | uniq -c | sort last = last searches through file /var/log/wtmp (or file designated -f flag) , displays list of users logged in (and out) since file created. cut show desired column. the option -d specifies field delimiter used in input file. -f specifies field want extract 1 out put think not sure and sorting , is uniq command helpful remove or detect duplicate entries in file. tutorial explains few used uniq command line options might find helpful. if can explain command , explain why there 2 sorts appreciate it. you right on explanation of cut : cut -d" " -f1 (no need of space after f ) gets first f ield of stream based on d elimiter " " (space). then why sort | uniq -c | sort ? from man uniq : note: 'uniq' not detect repeated lines unless adjacent. may want sort input first, or use 'sort -u' without 

jquery - Display text of just the element clicked -

i need able click on div, show text within it, when clicking on div, hide other text in other divs , show text in clicked div. code here http://jsfiddle.net/refxq/140/ <div class="myclass"><span>first</span></div> <div class="myclass"><span>second</span></div> <div class="myclass"><span>third</span></div> .myclass{ height:50px; width:100%; background-color:red; margin:2px; } .myclass span{ display:none; } $(".myclass").click(function() { // hide item spans $(".myclass span").hide(); // show element next $(this).first().show(); }); this work : see fiddle $(".myclass").click(function() { // hide item spans $(".myclass span").hide(); // show element next $(this).find('span').show(); });

xml - Repeating element after xsd:all -

i'd ask if possible allow 1 element repeated after xsd:all. this: <xsd:complextype name="animal"> <xsd:all> <xsd:element name="name" type="nametype"/> <xsd:element name="price" type="salarytype"/> </xsd:all> <xsd:element name="note" type="xsd:string" minoccurs="0" maxoccurs="unbounded"/> </xsd:complextype> this not valid because there cannot element after xsd:all, how can achieve this? you can't have element child of complextype . need all group inside sequence , illegal ( all has top level of complex type, , can't contain groups - elements , references). all restricted want. a solution not use all use different group , configure behaves group declared. here alternatives. can choose 1 works or experiment bit , adapt one. 1) choice element allows select 1 group. declaring cho

symfony - Symfony2 - Execution order of test cases -

i'm using symfony functional tests in netbeans. possible define order in order test cases executed? for example: have " usertestcase " case testing registration of users, changing profiles etc, , " forumtestcase " testing creation of forum posts etc. want run usertestcase before forumtestcase. order according file names (f.. before u..) you need define order of tests in phpunit.xml described in docs example: <phpunit> <testsuites> <testsuite name="object_freezer"> <file>tests/freezer/hashgenerator/nonrecursivesha1test.php</file> <file>tests/freezer/idgenerator/uuidtest.php</file> <file>tests/freezer/utiltest.php</file> <file>tests/freezertest.php</file> <file>tests/freezer/storagetest.php</file> <file>tests/freezer/storage/couchdb/withlazyloadtest.php</file> <file>tests/freezer/storage/couchd

javascript - Jquery Autocomplete doesn't work -

i'm trying add autocomplete input box (i'm in asp.net/vb.net project) autocomplete source database. i've created webservice , did ajax call: <script type="text/javascript"> $(document).ready(function () { $('#modelloinput').autocomplete({ source: function (request, response) { $.ajax({ type: "post", contenttype: "application/json; charset=utf-8", url: "webservices/autocompletews.asmx/gettuttiimodelli", data: "{'prefix':'" + request.term + "'}", datatype: "json", async: true, success: function (data) { response(data.d); },

c# - Encog Neural Network Error Never Changing -

i'm getting started working neural networks. have adapted xor example provided own purposes, when run error never changes. the function i'm trying approximate takes 4 doubles , outputs 1 double, 4 inputs positive, output can negative or positive (majority positive). starters using 50 records train data. working xor (the error goes down each iteration) public static double[][] xorinput = { new[] {0.0, 0.0}, new[] {1.0, 0.0}, new[] {0.0, 1.0}, new[] {1.0, 1.0} }; public static double[][] xorideal = { new[] {0.0}, new[] {1.0}, new[] {1.0}, new[] {0.0} }; basicnetwork network = new basicnetwork(); network.addlayer(new basiclayer(null, true, 2)); network.addlayer(new basiclayer(new activationsigmoid(), true, 3)); network.addlayer(new basiclayer(new activationsigmoid(), false, 1)); network.structure.finalizestructure(); network.reset(); imldataset trainingdata = ne

java - removing multiple selections from JList -

i have jlist elements multiple selection allowed. before these elements added jlist, information them being stored in static hashmap in separate class. when more 1 items selected , 'remove selected' button pressed, trying remove selected items (which works fine) , delete records hashmap. reason though, if select more 1 elements, first record in hashmap removed. don't understand how works jlist doesn't work hashmap. code below: remove.addactionlistener(new actionlistener() { @override public void actionperformed(actionevent e) { object[] selectedelementsvalues = jlist.getselectedvalues(); (int = 0; < selectedelementsvalues.length; i++) { system.out.println(jlist.getselectedvalue().tostring()); system.out.println(personclass.map.get(jlist.getselectedvalue().tostring())); personclass.map.remove(jlist.getselectedvalue().tostring()); system.out.printl

java - How can I get request from the client with JSON data and fileupload via JAX-RS(Jersey)? -

i need request client json data , image file in single request via jax-rs. how can receive in server side java application process further. @post @path("/path") @consumes({mediatype.application_json, mediatype.multipart_form_data}) public string get(@context uriinfo uriinfo, final mydto mydto, @formdataparam("file") final inputstream inputstream, @formdataparam("file") final formdatacontentdisposition filedetail) { } i having above code not working expected. this code working project. send file data , meta. try same. @post @path("import") @consumes(mediatype.multipart_form_data) @produces(mediatype.application_json + "; charset=utf-8") @rolesallowed(systemroles.admin) public void importscenario(@formdataparam("importscenario") final inputstream is, @formdataparam("complectid") final long complectid) { log.debug("start import f

javascript - Dropdown menu working different in mozilla firefox -

i did dropdown menu. works different in mozilla firefox. if visit demo page can understand problem. when click on menu works differently. in other browsers working normally. demo in jsfiddle css menu : a.change_photo_link{ position:absolute; line-height:25px; width:20px; height:20px; cursor:pointer; display:block; border: 1px solid rgba(128,128,128,1); -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; background-image: rgba(235,235,235,1); background-image: -webkit-linear-gradient(top, #2cbdf2 0%,#f0f0f0 0%,#d9d9d9 100%); background-image: -moz-linear-gradient(top, #2cbdf2 0%,#f0f0f0 0%,#d9d9d9 100%); background-image: -o-linear-gradient(top, #2cbdf2 0%,#f0f0f0 0%,#d9d9d9 100%); background-image: -ms-linear-gradient(top, #2cbdf2 0%,#f0f0f0 0%,#d9d9d9 100%); background-image: linear-gradient(top, #2cbdf2 0%,#f0f0f0 0%,#d9d9d9 100%); -webkit-box-shadow: rgba(128,128,128,1) 0px 0px 0px 0p