Posts

Showing posts from June, 2014

watir webdriver - How to select value from select list -

Image
i tried choose value select list. used code: browser.select_list(:id => 'isc_2w').select 'animal' but solution doesn't work. site can find select-list: http://www.smartclient.com/smartgwt/showcase/#featured_tile_filtering ok, first @ it's doesn't select-list, style select-list, but, can it: browser.element(:xpath, '//*[@id="isc_2y"]').click browser.element(:text, 'animal').click

RVM gems [ missing bin/ruby ] -

after executing rvm list following output: rvm rubies gems [ missing bin/ruby ] =* ruby-2.0.0-p645 [ x86_64 ] ruby-2.1.6 [ x86_64 ] ruby-2.2.1 [ x86_64 ] what gems [ missing bin/ruby ] means? does gems kind of system gemset? wasn't created me , don't know if can (or should) remove it. you've have installed rvm using code : curl -ssl https://get.rvm.io | bash -s stable --ruby . uninstall rvm using code: rvm implode once uninstalled, install rvm again using this: curl -l https://get.rvm.io | bash -s stable no more errors :d just had same problem , fixed :d

angularjs - Directive not working on chosen directive -

Image
i wrote simple directive : myapp.directive('input', function () { return { restrict: 'e', //scope: false, link: function (scope, elem) { if (scope.lang && elem.attr('type') === 'text') { elem.attr('lang', 'fa'); console.log(scope.lang); } } }; }); it's working fine, it's not working on chosen input search ? idea?

Not able to access Xml file when code is executed using Junit -

i working on "robotium junit" . have come across situation where, code not able find xml file on given path.(provided specified path correct). if run same code(file reading) normal java working fine. but when run code junit , code cannot find specified xml file. here code: refer public void test_insert(); import java.io.file; import java.io.ioexception; import com.robotium.solo.solo; import com.rohit.databse_crud.dbreader; import com.rohit.databse_crud.insert_act; import android.test.activityinstrumentationtestcase2; import android.util.log; @suppresswarnings("unchecked") public class initialbuttontest extends activityinstrumentationtestcase2 { private static final string launcher_activity_full_classname = "com.xyz.dat.splashactivity"; private static class launcheractivityclass; static { try { launcheractivityclass = class .forname(launcher_activity_full_classname); } catch (classnotfoundexception e) {

MARIE simulator: multiplication of two numbers using addition -

multiplication of 2 numbers 6 , 3 by, repeatedly addition of 3 6 times,using loop add 3 6 times , store result accumulator. input store x input store y loop, load x add multiply store multiply load y subt 1 store y skipcond 400 jump loop load multiply output halt x, dec 0 y, dec 0 one, dec 1 multiply, dec 0

mysql - Update model from database is not updating -

i working on solution .edmx file the environment is: vs 2013 entity framework 5.0.0.0 .net version 4.0 (so efw 4.40) sql server 5.1 mysql vs 1.1.4 mysql connector 6.4.4 i have added new field in table in model, when trying update model database, won't update actually, when prompted "choose database objects , settings", can't expand tables , views. any appreciated. one thing i've noticed ef model wizard won't appear if i'm using nuget because nuget pulls latest version of packages vs plugin installed once - there no error when happens; prompted connection , no wizard appears. here's scenario: i'm using mysql connector version 6.6.3 installed mysql server nuget updates driver package in project 6.9.8 on build wizard stops working because 6.6.3 != 6.9.8 to correct removed mysql references nuget , added them local machine. same version mysql connector , magically works again. hope helps.

jquery - Does ajaxify work locally? -

does ajaxify work live? say, doesn't work locally? i’m working on local site, have basic implementation , hasn't changed anything. yes, ajaxify can work locally also. library based on jquery. please check these points in code: you need replace urls sending request. you need check if have internet access (not sure may using external library too). you need add jquery library @ above of library. here more ajaxify .

php - Setting the strategy in a Strategy Pattern -

i might have implementing wrong cannot figure out solid way of setting strategy use in implementation of strategy pattern. i'm not big fan of writing "statically", perhaps there way. backstory: i've done 2 (2) implementations (soap + http) shipping providers in order retrieve track & trace information whatever user inputs frontend. each follow interface know functions , should (php :3) available. i've shortened class names below magento , class names long. flow: customer inputs tracking number in form , submits. request sent controller, controller initializes instance of service class, sets output via. $service->setoutput('tracking/service_gls') - note tracking/service_gls maps directly service class (magento thing), $service->getdeliveryinformation($number) called (we know exists because of interface), entire $service object returned view , data presented. my challenge: i'm using switch case set tracking/service_gls , tracking/s

java - SSL TCP connection on Android (with cert) -

i'm new on android platform, coming .net world. need write tcp/ssl client class in app, send/recieve text messages java server. need use server public certificate (.cer file) in communication. in c# have sslstream class job, , lot of examples it. android (lolipop) cannot find examples on subject, without http protocol on top. hint appreciated. below basially steps create ssl connection in android : step 1 : public key of ur server (.cert file), have. step 2: create keystore via bouncycastle jar below commands : keytool -importcert -v -trustcacerts -file "path_to_cert/interm_ca.cer" -alias intermediateca -keystore "res/raw/mykeystore.bks" -provider org.bouncycastle.jce.provider.bouncycastleprovider -providerpath "path_to_bouncycastle/bcprov-jdk16-145.jar" -storetype bks -storepass mysecret verify if certificates imported correctly keystore: keytool -list -keystore "res/raw/mykeystore.bks" -provider org.bouncycastle.j

asp.net mvc - Session state not available in Global.asax's AcquireRequestState nor PostAcquireRequestState events -

i have asp.net mvc application has per-user settings, including current culture settings. we're supposed set thread.currentthread.currentculture within application_acquirerequeststate or application_postacquirerequeststate events of httpapplication . i want maintain users' settings in session state dictionary, inside application_acquirerequeststate method observe: httpcontext.current.session == null the quickwatch window reports this.session : ((system.web.httpapplication)(this)).session' threw exception of type 'system.web.httpexception' system.web.sessionstate.httpsessionstate {system.web.httpexception} "session state not available in context." interestingly, httpcontext.current._sessionstatemodule == null true, though have <sessionstate mode="inproc" /> in web.config file. why session unavailable? i ran problem , manage solve after studies. hope can help. i'm unsure of part have <sessionstate mode

java - After scrolling in the listview, elements are swapped -

i writing time-tracking app, every row of listview has 2 buttons(start , stop) , textview display elapsed time. after scrolling in listview, elements swapped. i'm not sure in solution, put in model class, viewholder object getting acces changing view elements. here fragment of code model private string name; private boolean isstart=false; private long elapsedtime=0l,seconds=0l,hours=0l,minutes=0l,lastpause=0l,updatetime=0l,starttime=0l,days=0l; private runnable updatetimethread=new runnable() { @override public void run() { if(isstart && starttime!=0) { updatetime = ((system.currenttimemillis() - starttime) + lastpause); seconds = updatetime / 1000; minutes = seconds / 60; hours = minutes / 60; seconds = seconds % 60; minutes = minutes % 60; hours = hours % 24; holder.days.settext(string.format("%04d", days)); holder.hours.settext(string.format("%02d", hours));

Ruby Metaprogramming: Dynamically defining method based on child instance attribute -

i'm creating presenter base class supposed wrap activerecord object. class basepresenter def initialize object @object = object end def method_missing(*args, &block) @object.send(*args, &block) end def self.wrap collection collection.map { |item| new item } end end for each child class, able dynamically define method based on child attribute @ initialization, listpresenter like: class listpresenter < basepresenter end should respond list_id wrapped list object's id. how short of defining on every child class? i've tried following in def initialize(object) , both of not work. prefer avoid eval based approaches if possible hear it's code smell. class approach (adds method basepresenter, not child classes) self.class.send(:define_method, "#{object.class.name.underscore}_id") @object.id end metaclass approach (unable access instance variables object or @object ): class << self define_method

c - Overwrite a line in a file -

i'm trying overwrite line in file contains unsigned long numbers. contents of file this: 1 2 3 4 5 i want replace specific number number 0. code wrote looks this: file *f = fopen("timestamps", "r+"); unsigned long times = 0; int pos = 0; while(fscanf(f, "%lu\n", &times) != eof) { if(times == 3) { fseek(f, pos, seek_set); fprintf(f, "%lu\n", 0); } times = 0; pos = ftell(f); } fclose(f); f = fopen("timestamps", "r"); times = 0; while(fscanf(f, "%lu\n", &times) != eof) { printf("%lu\n", times); times = 0; } fclose(f); the output of program looks this: 1 2 10 5 interestingly, if cat file, looks this: 1 2 10 5 am making mistake in ftell ? also, why didn't printf show missing line cat showed? i reproduce , fix. the present problem when open file in r+ must call fseek @ each time switch reading writing , writing read

c# - Stream to string -

how append stream output string instead of file in code? httpwebresponse res = (httpwebresponse)httprequest.getresponse(); using (stream output = file.openwrite(@"c:\temp\tmp.html")) using (stream input = res.getresponsestream()) { byte[] buffer = new byte[8192]; int bytesread; while ((bytesread = input.read(buffer, 0, buffer.length)) > 0) { output.write(buffer, 0, bytesread); } input.close(); output.close(); } you can use streamreader : httpwebresponse res = (httpwebresponse)httprequest.getresponse(); using (stream input = res.getresponsestream()) using (var streamreader = new streamreader(input)) { string result = streamreader.readtoend(); } note read entire string memory.

gcc - C/C++: -msse and -msse2 Flags do not have any effect on the binaries? -

i'm playing around gcc (g++) , compilerflags -msse , -msse2. have little test program looks that: #include <iostream> int main(int argc, char **argv) { float = 12558.5688; float b = 6.5585; float result = 0.0; result = * b; std::cout << "result: " << result << std::endl; return 0; } when compile following statements: /usr/local/bin/g++-4.9 -w -msse main.cpp -o testsse and /usr/local/bin/g++-4.9 -w -msse2 main.cpp -o testsse2 the output files binary equal. i've expected not same because of smid flags. so question is, complier flags not have influence on binary file? i've tested on os x 10.10.3 , fedora 21. thanks help. kind regards fabian in code basic floating point maths involved. , bet if turn optimizations on (even -o1 ) gets optimized out because values constant expressions , calculable @ compile-time. sse used ( movss , mulss ) because it's threshold of floating point

python circular import and definition of exception classes -

i know way python acts circular imports through creating references in sys.modules . please see these 2 modules , problem defining exception class: a.py import b class err(exception): pass if __name__ == '__main__': try: b.f() except err: pass b.py from import err def f(): raise err() seems should catch err it's not correct. output of running a.py is: $ python a.py traceback (most recent call last): file "a.py", line 8, in <module> b.f() file "b.py", line 4, in f raise err() a.err ok, let add logs code make more clear: a.py: print 'a1' import b print 'a2' class err(exception): pass print 'a3', 'id(err)=%x' % id(err) if __name__ == '__main__': try: b.f() except err: pass b.py print 'b1' import err print 'b2', 'id(err)=%x' % id(err) def f(): raise err() the output is: $ py a.py

mailchimp - Getting theMailchimp Member info with PHP/API with campaign EID -

i using mailchimp api few things successfully, 1 thing want do, can not find answer for, using mc_eid , request members basic info ( first/last name, email ). i can if have email address, if have mc_cid & mc_eid have not found way yet. am missing here. thanks it sounds you're collecting data ecommerce360 , hoping link specific list subscriber. require 2 steps. first, need find list associated campaign id. that, call campaigns/list call, supplying mc_cid filter campaign_id. once have list_id campaigns/list call, can call lists/member-info . you'll pass list_id id parameter call, , you'll pass mc_eid emails.euid parameter. to make more efficient, you'll want cache campaign_id / list_id relation.

design patterns - model management in MVC -

i'm searching best practice making model in mvc. i'm making socket server concurrent users. understand, model in mvc has included business logic if model data access or maybe db sao. how can model object updated when else has changed attribute in db ? the first solution can think of attribute of model accessing database. second 1 make model pool , modify reference. any suggestion?? if have 1 server , 1 process, cache model (static variables or similiar) , have 1 model in memory mirrors database. scale bad (or better won't scale @ all). depending on how latency tolerate, have several servers , processes have own caches, updating database in regular intervals. of course mean data corruption. way if 1 server changes entity informs other servers via sockets invalidate entity in caches. midway servers cache in memory, every time object requested, timestamp (or version) pulled database decide wether cache date.

php - how to remove whole img element with a SRC value in an UTF-8 string? -

for example algorithm: $text = 'some text1 <img src="1.jpg" /> text2 <img src="2.jpg">'; if($src == '1.jpg') remove(img tag in $text) echo htmlspecialchars($text, ent_quotes, "utf-8") and result must be: some text1 text2 <img src="2.jpg>" use preg_replace directly, no condition , preg_match needed. $text = 'some text1 <img src="1.jpg" /> text2 <img src="2.jpg">'; echo preg_replace('~(<img.*[\'"]1\.jpg[\'"].*>)~', '', $text); // text1 text2 <img src="2.jpg"> the first ['"] needed avoid removing eg. a1.jpg file, second 1 optional. it's better understand how works. update due comment below, here updated version variable name: $file = '1.jpg'; $text = 'some text1 <img src="1.jpg" /> text2 <img src="2.jpg" />'; echo preg_repl

View not Recognizing the methods of the Model in PHP -

i'm able load model in view method inside model not recognized view. can point out on i'm going wrong. i'm using pip mvc framework http://gilbitron.github.io/pip/ p.s. i'm new mvc. model.php class model { private $connection; public function __construct() { global $config; $this->connection = mysql_pconnect($config['db_host'], $config['db_username'], $config['db_password']) or die('mysql error: '. mysql_error()); mysql_select_db($config['db_name'], $this->connection); } public function execute($qry) { $exec = mysql_query($qry) or die('mysql error: '. mysql_error()); return $exec; } my model class listing_model extends model { public function createnewjob($by) { $result = $this->execute('insert job_listings (by_user_id) values ('.$by.')'); return $result; } } controller: function create() { $template = $this->loadview('

ruby inheritance. Converting one object into another -

i not know terminology of trying googling has proven hard. i have 2 ruby classes. class < activerecord::base end class b < end class hits database. there column in class stores intended class name. in example value of column in class 'b'. my desire find way call a, , b. thought being there more b in future end having c, d, , e. of these classes require unique methods. rails' single table inheritance can you: http://api.rubyonrails.org/classes/activerecord/base.html#class-activerecord::base-label-single+table+inheritance

assembly - x64 CMPPD (Compare packed 64-bit floats) instruction -

the cmppd instruction (page 545 of intel x64 manual) says reverses operands if need use greater or greater or equal to. makes sense instruction takes 2 registers how swap operands address , register version? you're either going have load memory operand register, use inverse comparison (greater equivalent of nle except nans) or use avx instruction (vcmppd) doesn't have limitation.

java - Why is selection sort performing better than insertion AND quick sort -

i have below algorithms insertion sort, selection sort , quick sort respectively. i've run test sorting array of 10,000 integers between 0 - 1000 10 times each algorithm. curious thing average selection sort lower both insertion sort , quick sort. averages 182044.4, 217.9, , 545.4 milliseconds insertion, selection, , quick sort respectively. allowing fact can make small enhancements insertion , quick sort, wouldn't expect lack of enhancements result in such large differences. wrong in implementation here? again, not small enhancements such moving indices or checks, actual errors. i've provided, code tests , results below thanks public final static <e extends comparable<e>> arraylist<e> insertionsort(arraylist<e> arr) { for(int = 1; < arr.size(); i++) { for(int j = i; j > 0; j--) { if(arr.get(j).compareto(arr.get(j - 1)) < 0) { swap(arr, j, j-1); }else

input - Java lwjgl keyboard handler -

i've created class takes lwjgl's keyboard input , turns list of strings keys being pressed. public class keyhandler { arraylist<string> keyspressed; public keyhandler() { keyspressed = new arraylist<string>(); } public void checkkeys() { while (keyboard.next()) { string keystring = keyboard.getkeyname(keyboard.geteventkey()); if (!keyspressed.contains(keystring)) { keyspressed.add(keystring); // key has been pressed } else { keyspressed.remove(keystring); // key has been released } } } public void runkeys() { if (keyspressed.size() > 0) { (string str : keyspressed) { system.out.println("key handler got key:" + str); // run class key } } else { // no keys have been pressed } } } i'm trying figure out way 'runkeys' run class name, example. w.ja

javascript - How to make data stable until we get back response in xhr? -

when send simple xmlhttprequest() with asnyc = 1 the html page i've loaded blinks, why? can't stable until response got? i using responsetext fetch contents. my actual code running at: http://fastchat.ga/chat and also, sometimes the request not sent, why? can has answer? fist of all, setinterval(showmsg,5000); please dont use strings calling functions... way better. then, don´t notice blinking, if field boolean, should use boolean instead of using 1 (it's not falsy value, it's not true). i'd recommend, avoid using argument, given it's default value true. good luck

java - Focus not being set by method to grab focus -

learning code, building gui figure out how interacts. trying write method set focus on (component) @ points need in larger program - ie call focusgrabber(jtextfield1) , have set input focus on jtextfield1 . in attempt best sscce, i've made simple main makes enough gui give 2 textfields should set focus on second. package odin; import java.awt.component; import java.util.list; import javax.swing.jcomponent; import javax.swing.jframe; import javax.swing.jlabel; import javax.swing.jtextfield; /* */ class focusgrabber implements runnable { private jcomponent component; public focusgrabber(jcomponent component) { this.component = component; } @override public void run() { component.grabfocus(); } public static void main(string[] args){ //draw , show gui jframe gui = new jframe(); gui.settitle("new provider interface"); gui.setdefaultcloseoperation(jframe.exit_on_close); final jtextfie

dependency injection - How to use oracle sequence while insert/update in SAS DI 4.8 -

i'm joining sybase table , sas data set insert/update data using table loader in oracle. table id needs loaded using sequence resides in oracle. can please let me know how use oracle sequence generate id column? tried adding dummy column same oracle table joined result set , tried specifying seqname.nextval in expression editor getting error: error: unresolved reference table/correlation name seqname. if need use kind of oracle-specific functionality di studio need use custom code step , write sql within 'proc sql' passthrough statement. if code re-used in several places have option write di transformation.

java - Given a .jpg or .png, and a URL, how to generate a "LogoQ" type of QR code? -

Image
from www.qrcode.com , "logoq new type of qr code created enhance visual recognizability combining letters , pictures in full color." i able take image file , url , generate such qr code, similar offered @ website visualead.com -- without generated qr code redirecting site, , potentially encountering ads, before original url opened. have searched bit "logoq" not find useful results. i'm open using python, java, or imagemagick, or whatever other libraries or tools might suitable this. thank you. creating logoq themed qr code simple task imagemagick . imagemagick language bindings cover both java , python , i'll give example cli utilities. for creating logoq, screen compose logo graphic on qr code. convert /path/to/qr_code.png \ /path/to/logo.png \ -compose screen \ -composite \ /path/to/logo_qr.png there many ways, libraries, , apis generate qr code. half remember google providing free api , that&#

ruby on rails - How do I make the Posts comments available in my homepage and user/show view? -

here homecontroller: class homecontroller < applicationcontroller def home if logged_in? @post = current_user.posts.build @feed_items = current_user.feed.paginate(page: params[:page]) end end def end def privacy end def terms end end here comments controller: class commentscontroller < applicationcontroller def create @post = post.find(params[:post_id]) @comment = @post.comments.create(comment_params) redirect_to root_path end private def comment_params params.require(:comment).permit(:author_name, :body) end end my posts controller: class postscontroller < applicationcontroller before_action :logged_in_user, only: [:create, :destroy] def create @post = current_user.posts.build(post_params) if @post.save flash[:success] = "post created!" redirect_to root_url

html - Bootstrap alignment - nav header alignment -

Image
i trying achieve this: however, because have image, left aligned, , 2 lines next image (one h1 , 1 h2), battling 'brand' box inside nav bar. seems have lot of padding , strange stuff going on. this nav bar code: <div class="navbar navbar-inverse navbar-custom shadow_bottom navbar-fixed-top" role="navigation"> <div class="container"> <!-- brand , toggle grouped better mobile display --> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#small-navbar-button"> <span class="sr-only">toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"

multithreading - Java Threads Busy Waiting -

hi doing project , have reached part stuck. have tried search ways learn how write while loop busy wait haven't found , code runs infinite loop. can explain me how busy waiting loop should work , me break out of infinite loop? the project wants following happen: in morning, after student wakes (it take random time) head bathroom ready new school day. if bathroom taken, student takes break (use yield()) , later on wait (use busy waiting) bathroom become available. students use bathroom in first come first serve basis (you can use boolean array/vector having them released in order). public class student implements runnable { private random rn = new random(); private string threadnum; private volatile boolean bathroomfull = false; private static long time = system.currenttimemillis(); private thread t; public student(string studentid) { threadnum = studentid; t = new thread(this, "student thread #"

How to set permissions for WebDAV in IBM WebSphere portal 8.0.0.1 -

i trying install new theme in ibm portal 8001, using webdav anyclient uploading static resources of theme in theme list doesn't upload files. do have give permissions webdav in portal? i have added 'all portal users' access theme management in portal access control. though doesn't upload files. i have tried using webdrive, bitkinex clients still doesn't upload files. in addition access rights need enable write non administrative users. see below instructions to enable write access authenticated users, proceed follows: add following property wp configservice resource environment provider in websphere® application server administrative console: filestore.writeaccess.allowed. set value property true . restart portal server new setting take effect. https://serverfault.com/questions/555638/how-do-i-enable-webdav-write-access-in-websphere-portal-8-0

How can I control Google Hangouts with Python? -

as python project, control google hangouts (start/end video/phone calls, mute/unmute, dial key, etc) using python 2.7; e.g. create call() function accepts email addresses , phone numbers of people in circles/contacts , call people. as newbie, however, don't know whether: there python package (most of) that, i need sign google cloud, install google cloud sdk, learn how use google app engine, etc. or being logged google in browser sufficient so, i'd appreciate if sketch brief road map me. for example, python packages need? hangups, python instant messaging client hangouts exists , worth look. it's terminal client, used back-end several gui applications. https://github.com/tdryer/hangups

javascript - To Do List using JQuery and LocalStorage -

hi guys i'm trying create todo list using jquery , local storage. if localstorage has values already, should populate when page loads (closing window , reopening retains "todo's") if item exists in list, show console message noting duplicate (using $.inarray) user should able add , remove items , have changes save automatically (using splice) this have far: <body> <h1>todo list</h1> <input id="input" type="text"><button id="add">add</button> <ul id="list"></ul> </body> <script src="http://code.jquery.com/jquery-2.1.3.min.js"></script> <script> if(window.localstorage !== undefined){ var storedata = { }; var input = $("#input").val(); $("#add").click(function (){ localstorage.setitem("input", json.stringify(input)); }); }; $(document).ready(function(){ var data = json.parse(localstorage.getit

for loop - Assigning variables? -

i have looked awhile find answer, see similar codes , try adjust code work. basically, need textboxes on userform turn red white font based on text received work sheet in 1 of textboxes. know close, don't understand placement of wording! sub changeclr() dim tbmytextbox textbox dim ufmyuserform userform each tbmytextbox in ufmyuserform if tbaction1 = "tank in spec" tbmytextbox.backcolor = vbgreen tbmytextbox.forecolor = vbblack else tbtextbox.backcolor = vbgreen tbmytextbox.forecolor = vbblack end if next tbmytextbox end sub now know using vbscript in excel, code loop thru , change text boxes (including action one) based on wording in action text box. can tweak exact specifications. dim varcontrol control each varcontrol in ufmyuserform.controls if typeof varcontrol msforms.textbox if tbaction1 = "tank in spec" varcontrol.backcolor = vbred varcontr

php - How to pass a value from one controller to another controller in laravel -

i struggling passing variable 1 controller method in laravel. when user creates product, want let him result. problem after create method executed, message should passed 1 more controller before goes view. i trying pass success or failure message postcreate method getlist method. create method: public function postcreate() { if(validation passes){ //create product return redirect::to('admin/products/list/'.$current_section_id) ->with('message', 'new product created'); } else{ return redirect::to('admin/products/new) ->with('message', 'something went wrong'); } } getlist method returns user page before (current_section_id) , list products public function getlist($id){ $message = input::get('message'); return view::make('products.list') ->with('current_section_id', $id)

Azure WebJob Failed with exit code -1073741818 -

i have deployed azure webjob existing azure website using visual studio's helpful 'publish webjob' menu option. the package works fine locally, when pushed cloud doesn't reach first line of code (which log statement) , following message: [04/25/2015 19:35:44 > 287dbc: sys info] status changed initializing [04/25/2015 19:35:45 > 287dbc: sys info] run script 'myjob.exe' script host - 'windowsscripthost' [04/25/2015 19:35:45 > 287dbc: sys info] status changed running [04/25/2015 19:35:45 > 287dbc: sys info] status changed failed [04/25/2015 19:35:45 > 287dbc: sys err ] job failed due exit code -1073741818 i've tried copying package content manually via ftp , same thing. has ever run this? how did manage fix it?

visual studio 2010 - How to publishing a Vensim model via code. -

i'm working visual studio 2010 in c # language. want publish model using code (dll vensim dss) , not using gui of vensim dss. possible? no. not possible via code. reason publishing ensure licensed copy of vensim dss used generate model.

javascript - Math.Random to draw image -

i trying use math.random draw image. though know haven't got right. i know need loop go through math.random function, don't know how implement it. know spawnrock function isn't correct not know how fix it. help? this code breaks current drawimages. var num; function mathrock() { var x = math.floor((math.random() * 10) + 1); document.getelementbyid("num").innerhtml = x; } function spawnrock() { if (num = 2, 4, 8){ context.drawimage(rock, 1500, 450); } else { } var rock = new image(); rock.src = "rock.png"; here's quick primer on math.random math.random() * x generate random floating point number between 0 (but not including) x. math.random*10 generate, example, 0.22, 1.56, 7.92 9.9999999999. if need random integers , can strip off non-integer portion of random number parseint( math.random()*10 ) g

json - How do I decode HTML entities in swift? -

i pulling json file site , 1 of strings received is: the weeknd &#8216;king of fall&#8217; [video premiere] | @theweeknd | #sophi how can convert things &#8216 correct characters? i've made xcode playground demonstrate it: import uikit var error: nserror? let blogurl: nsurl = nsurl.urlwithstring("http://sophisticatedignorance.net/api/get_recent_summary/") let jsondata = nsdata(contentsofurl: blogurl) let datadictionary = nsjsonserialization.jsonobjectwithdata(jsondata, options: nil, error: &error) nsdictionary var = datadictionary["posts"] nsarray println(a[0]["title"]) there's no straightforward way that, can use nsattributedstring magic make process painless possible (be warned method strip html tags well): let encodedstring = "the weeknd <em>&#8216;king of fall&#8217;</em>" // encodedstring should = a[0]["title"] in case guard let data = htmlencodedstring.dat

How to redirect a specific URL with .htaccess -

i want redirect http https specific url login, signup currently using bellow .htaccess rewritecond %{https} !=on rewriterule ^.*$ https://%{http_host}%{request_uri} [l,r=301] using page redirect https want redirect example.com/login , example .com/signup rewritecond %{https} =off rewriterule ^login https://%{http_host}%{request_uri} [r=301,l] rewritecond %{https} =off rewriterule ^signup https://%{http_host}%{request_uri} [r=301,l]

ios8 Core Data iCloud Today Widget not synchronizing -

i have been unsuccessful in getting core data work on app , today widget on device. let url = nsfilemanager.defaultmanager().containerurlforsecurityapplicationgroupidentifier("group.mygroup.name").urlbyappendingpathcomponent("filename.sqllite") var error: nserror? = nil let options = [nsmigratepersistentstoresautomaticallyoption: true, nsinfermappingmodelautomaticallyoption: true,nspersistentstoreubiquitouscontentnamekey:"sharedcontainername" ] let s = coordinator?.addpersistentstorewithtype(nssqlitestoretype, configuration: nil, url: url, options: options , error: &error) i have added group container use url of stores. have noticed on simulators persistent coordinator points same sqllite file (url: file:///users/xxxx/library/developer/coresimulator/devices/6cxxxxxx/data/containers/shared/appgroup/e65xxxxxx/filename.sqllite)) this seems work fine on simulator , can store data in main app , fetch in

python - Dereference relations in MongoEngine embedded documents -

i have schema using mongoengine looks this class user(db.document) email = db.emailfield(unique=true) class queueelement(db.embeddeddocument): accepts = db.listfield(db.referencefield('resource')) user = db.referencefield(user) class resource(db.document): name = db.stringfield(max_length=255, required=true) current_queue_element = db.embeddeddocumentfield('queueelement') class queue(db.embeddeddocument): name = db.stringfield(max_length=255, required=true) resources = db.listfield(db.referencefield(resource)) queue_elements = db.listfield(db.embeddeddocumentfield('queueelement')) class room(db.document): name = db.stringfield(max_length=255, required=true) queues = db.listfield(db.embeddeddocumentfield('queue')) and return json object of room object include information queues (together referenced resources), , nested queue_elements ( referenced "accepts" references, , user references) howev

Calling A Created Class In A Test Class In Java -

i have created public class: employee . create drive class test new class. however, cannot figure out how call created class within driver class: employeetest . have placed each class ( employee , employeetest ) in same directory; however, still receiving error message: "cannot find class employee ." can me on right track? here code class employee : package employee; /** * * @author ljferris */ public class employee { private string first; // instance variable first name private string last; // instance variable last name public double salary; // instance variable monthly salary // constructor initializes first parameter firstname , intializes last parameter lastname public employee(string firstname, string lastname){ this.first = firstname; this.last = lastname; } // constructor initializes salary parameter monthlysalary public employee(double monthlysalary){ this.salary = monthlysalary; } // method set first

Strange Syntax Error MySQL Error when using PHP -

i've got syntax error near line 1 somewhere in code: //... $nr = 126; $expl = "'test'"; $da = "'2003-12-01'"; $tax = 2.5; $cost = 100; //here error $sql = "insert tbl (type, nr, explan, date, tax, cost) values('example'," + $nr + ",'"+ $expl + "','" + $da + "'," + $tax + "," + $cost + ");"; this error log: error: 103.5 have error in sql syntax; check manual corresponds mysql server version right syntax use near '103.5' @ line 1 i'm using php version 5.6.3 , mysql version 5.6.21 i cant figure out, problem :( you're using + concatenate strings, doesn't work in php. have use . . there strange arithmatic going on produces 103.5 , 2.5 + "," + 100 . "," converted int(1) or something.

Change SQL Server primary key using C# -

i need change column type in sql server table. i need using script or c#. the original datatype integer , new type varchar(50) . i can using sql script: alter table confezionamento alter column partnumber varchar(50) but problem column in set of primary keys. when try execute, error occurred because pk_confezionamento using column. how can without access sql server management studio? you need run sql commands following steps: drop primary key constraint alter primary key add primary key constraint if there foreign keys or indexes, may have deal them well. the commands looking similar these: alter table confezionamento drop constraint pk_confezionamento alter table confezionamento alter column partnumber varchar(50) alter table confezionamento add constraint pk_confezionamento primary key (partnumber) these commands can sent c# using ado.net or similar methods.

ios - Displaying two sets of results in one TableViewController -

i know startlingly stupid question, can't figure out. every answer involves uisearchbar, not i've got. i'm trying display 2 sets of results on 1 tableviewcontroller. results display 1) everything in managedobjectcontext set in viewdidload 2) filtered set of results if predicate selected. on mytableviewcontroller , have popover instantiates when click uibarbuttonitem on mytableviewcontroller . on popover, set predicate on mytableviewcontroller . basically, i'd toggle what's displayed , display toggle driven whether variable nil (everything displays) or filtered (variable sets predicate). have 2 nsarray properties allvalues , filteredvalues . set delegate/datasource properties using filteredvalues array. next, when first data: self.allvalues = [somecontroller fetchallvalues]; self.filteredvalues = self.allvalues; [self.myview.tableview reloaddata]; last, alter filteredvalues array whether or not predicate selected: if (self.sel

SQL - count relation instances -

Image
i have sql diagram: i want subscribers likes 0 reports. started by: select * subscriber having count(...) how count how many reporters subscriber likes? a relationship should it's own table in sql database? i'm not sure understand last question, sounds nice time not in clause. select * subscriber id not in (select subscriberid likes inner join reporter on reporter.id = likes.reporterid) the inner query there finds subscriber ids have been reported, outer 1 grabs other ones. might able improve efficiency of query changing inner join in , you'd have play it. as far task of counting them, i'd this. group , such, simple, select *, (select count(*) likes inner join reporter on reporter.id = likes.reporterid likes.subscriberid = subscriber.id) reporterscount subscriber note listed task of finding ones 0 reporters, first query faster, because able short-circuit, rather

javascript - Rails render partial as widget over ajax using jsonp -

i've looked @ quite few other answers on here, i'm still struggling bit figure out how set rails widget. i have code in widget controller: def widget status = company.friendly.find(params[:id]).widget.active body = to_json_value(render_to_string('companies/_widget', locals: { profile: self.profile })) respond_to |format| format.js { render json: { status: status, html: body }, callback: params[:callback] } end end private def to_json_value(str) str.gsub!("\"", "\\\"") str.gsub!(/\n+/, " ") str end the self.profile method sets list of variables passed partial. what want give user javascript script tag can embed on (external) website. when user hits page, script make ajax call widget controller , if widget turned on, receive string of html rendered on page. so far i've got widget controller return json object status , html string. problem when paste localhost url json