Posts

Showing posts from May, 2010

android - gradle multiproject include and exclude libraries -

i trying build android project gradle. it has following structure: projecta----- mainproject, liba ---- library project, libb ---- library project, libc ---- library project, libd ---- library project, etc... based on situtation, need include libraries, need include libraries, 1 library, 2 or 3 etc. based on flavors. in settings file have included projects. does know how include/exclude libraries based on flavors? i have tried on dependency block, there getting error. following sample code dependencies { if (task.name.matches('compileflovor1'){ exclude module: 'libd' } } error is: not find method exclude() arguments [{module=libd}]. please guide me resolving issue do add flavour specific dependencies must configure according configuration. let's have flavours "free" , "payed" android { productflavors { free paid } } then can set flavour specific depende

SignalR client(SignalA) on android, does not work -

i beginner android programer. i'm having trouble signala . tried run signala client? how work??? wrote erick: download signala.longpolling. added reference signala.longpolling, added on signala.longpolling basic-http-client. then added mainactivity : package com.example.testdemo; import com.zsoft.signala.connection; import com.zsoft.signala.transport.statebase; import com.zsoft.signala.transport.longpolling.longpollingtransport; import android.os.bundle; import android.app.activity; import android.view.menu; import android.widget.toast; public class mainactivity extends activity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); string url = "http://signalrcalc.apphb.com/"; connection con = new com.zsoft.signala.connection(url, this, new longpollingtransport()) { @override public void onerror(ex

amazon web services - What is the AWS Account Id for Heroku in Europe? -

i'm looking move our heroku app eu region. our app uses amazon rds database i'll need add new european heroku ec2 cluster access whitelist. does know new aws account id? never mind, needed move amazon rds instance same region heroku in (eu-west-1). i've got working!

wso2esb - XSD import from file -

we in process of putting wso2esb server in between our webservices , our customers. i'am having problems imports , includes in wsdl-files. to make migration simple, thought we'd copy wsdl , xsd files we've got on directory on esb server (but outside of wso2esb software). in creating services in esb, refer wsdl-files using 'specify source wsdl'. this show wsdl, not (exactly) 1 we've created. we're using 'useoriginalwsdl=true', 'modifyuserwsdlportaddress=true', 'showabsoluteschemaurl=true'. in 1 of our wsdl we'ver got piece of code: <xs:schema targetnamespace="http: //www.egem.nl/stuf/wsdl/zkn0201.wsdl"> <xs:import schemalocation="xsd/stuf0204.xsd" namespace="http://www.egem.nl/stuf/stuf0204"/> <xs:import schemalocation="xsd/zkn0201.msg.xsd" namespace="http://www.egem.nl/stuf/sector/zkn/0201"/> </xs:schema> with above parameters set, shows in wsd

twitter - Are there separate bootstrap files for its different components? -

i want give of twitter bootstrap's goods , use css inputs: design , behavior , validators . there separate css file , other bootstrap components? taking code need base bootstrap css file hand annoying. you can use customize option, or tend use is: https://github.com/mdo/preboot starting point bootstrap , offers alot of mixins use achieve want without framework.

validation - PrimeFaces - Don't close dialog when messages appears -

how can set primefaces dialog not hide, when there "required-messages" open? @ moment, dialog closing clicking on "speichern" button, , when reopened, messages appears... let dialog open, when there unfilled required fields: <h:panelgrid id="createnewpat" columns="3" cellpadding="1" style="margin:0 auto;"> <h:outputtext for="versnr" value="versicherten-nr.:" /> <p:inputmask id="versnr" value="#{patientenbean.versnr}" required="true"/> <p:message for="versnr" /> <p:commandbutton id="savebtn" value="speichern" action="#{patientenbean.createpatient}" oncomplete="if (!args.messageoccured) createnewpat.hide();" update="patform" /> <p:commandbutton id="resetbtn" value="reset" type="reset" /> </h

mysql - querying primary keys from a foreign key -

i'm new mysql , struggling querying or referencing primary key's foreign keys specified in table. can please explain how in simple terms, i've searched bit hard understand considering majority of others have allot more mysql knowledge me. let's assume these tables: create table if not exists customer( custid int auto_increment, custlname varchar(30), custadd varchar(100), custsuburb varchar(30), custpcode varchar(4), custstate varchar(20), custphone varchar(10), primary key (custid) )engine = innodb; create table if not exists tour( dailytourid int, tourdate date, tourtime time, tourname varchar(30), tourdriverid int, tourbusid varchar(2), primary key (dailytourid, tourdate), ) engine = innodb; create table if not exists tourcustlink( tourcustlinkid int auto_increment, tourid int, tourdate date, customerid int, primary key (tourcustlinkid), foreign key (tourid, tourdate) refere

matlab - Showing an image -

i came matlab code first reads image , converts double follows: i = double(imread(img)); after that, shows image follows: imshow(i/max(i(:))) what mean? when removed max part, got image white background. goal of such division? and, why show image when done , doesn't show image if directly show read image without division max? thanks. the expression: i/max(i(:)) just normalises pixel values range 0..1.0. dividing pixel values max value.

Titanium iOS: Display gragh based on sqlite db datas -

in titanium, need guidance in plotting graph based on sqlite db values. tried rgraph plot graph, while importing getting errors in .css , .html files of rgraph framework. what need display graph based on datas db? can me in this?? in advance!

Unit Testing pattern -

i looking solution/pattern following unit testing case. the case: let's pretend have 3 classes, a,b,c each 1 method. a's method calls b's method calls c's method. so, a->b->c. each method take 1 input (input method a, input b, input c). resulting output of call method a, tree structure such as: root (created method a) -- node b (created method b) -- node c1 -- node c2 (both created method c) for me unit testing testing output input of method in isolation. so, write unit tests each of methods above. because tests written in isolation, mock method b when writing unit tests method a, , mock method c when writing unit test cases method b. so far, good, can write expectations on output each method make sure resulting tree structure respected. the problem: let's add class call method b have following call chain: d->b->c. resulting root tree this: root d node b node c1 node c2 during development, realise requirement met

android - How to add basic grids to GoogleMap Api v2 -

Image
i add basic grids googlemap use on maps. read docs didnt found help, maybe tileoverlay or groundoverlay can trick, didnt found examples or tutorials, not in official samples. can suggest me ways work ? e d t : yes gridlines this: seems have code that. used debugging, here is: debughelper.java . some notes: you have copy sphericalmercator.java change igooglemap original googlemap , iprojection projection clustersize parameter in degrees, have change depending on zoom finally: call drawdebuggrid in oncamerachange . if want see in action, may run demo of android maps extensions . change need make see grid setting debug_grid true on 1 of first lines in gridclusteringstrategy.java .

iis 7 - IIS 7 with Windows authentication fail -

i have folder on website want protect windows authentication. problem prompt re-appearing - credentials not correct. when in event viewer see audit success. i using local windows user authenticate. in iis->on folder have enabled windows authentication. in iis->in folder have allowed user in "authorization rules" any idea can wrong? give passwd in .ini file

.htaccess - How do i redirect a domain while displaying the old address? -

i've generated .htaccess file using host service 301 permanent redirect empty subdomain new subdomain page in folder. sejur-avion.old-domain.com --> subdomain.new-domain.com/agent/5049/sejur-avion rewriteengine on rewritecond %{http_host} ^sejur\-avion\.old\-domain\.com$ [or] rewritecond %{http_host} ^www\.sejur\-avion\.old\-domain\.com$ rewriterule ^(.*)$ "http\:\/\/subdomain\.new\-domain\.com\/agent\/5049\/sejur\-avion\/$1" [r=301,l] what need hide "new-domain" name address bar, , if possible display old domain's name instead. so need subdomain.new-domain.com/agent/5049/sejur-avion display subdomain.old-domain.com/agent/5049/sejur-avion i've heard there's serveralias function can use that? please help you can use mod rewrite's p flag sends request reverse proxied via mod_proxy: rewriteengine on rewritecond %{http_host} ^sejur\-avion\.old\-domain\.com$ [or] rewritecond %{http_host} ^www\.sejur\-avion\.old\-domain\.

java - Liferay Service Builder Not recognized function -

i added new method on service builder: public irrule rulecreation() throws systemexception, portalexception { irrule rule = new irruleimpl(); return rule; } the method recognised portlet class (no errors presented): public class ruleportlet extends mvcportlet{ public void addrule(actionrequest request, actionresponse response) throws exception { themedisplay themedisplay = (themedisplay)request.getattribute(webkeys.theme_display); irrule rule = irrulelocalserviceutil.rulecreation(); // method!!!! rule.setcompanyid(themedisplay.getcompanyid()); rule.setgroupid(themedisplay.getscopegroupid()); rule.setrulename(paramutil.getstring(request, "rulename")); rule.setruledescription(paramutil.getstring(request, "ruledescription")); rule.setrulefile(paramutil.getstring(request, "rulefile")); arraylist<string> errors = new arraylist<string>(); if (rulevalidator.validaterule(rule, errors)) {

regex - regExp matching using older JAVA API -

i m trying replace " \" in string. using java.util.regex.pattern.compile("\\\"").matcher(mystring).replaceall("\\\\\"") it works fine development machine m using newer version of java. on test machine throws noclassdeffounerror .the test machine closely resemble production environment has older version of java. not sure version is. i tried with, mystring.replaceall("\\\"","\\\\\""); it throws nosuchmethod exception. same problem with mystring.matches() can me out ways work regular expression in older java versions? thanks in advance.. from symptoms in question, running on jvm older version 1.4, when java.util.regex package introduced. think try push them upgrade system, since version 1.4 first released 11 years ago in 2002 . for now, can work around string.indexof , stringbuffer 1 . not pretty, sufficient fixed string searching , replacement 2 . if insist on regex, jregex library

iphone - Do you need to delete imported files from Documents/Inbox? -

i've got ios app imported files email attachment. i've noticed once i'm finished it places imported file documents/inbox. should app deleting these files or os around clearing them out? if so, how? i've tried: [[nsfilemanager defaultmanager] removeitematpath:[self.url path] error:nil]; however doesn't seem reference file in inbox, though self.url correct path import file. system not clear imported files, should clear them manually when necessary, not delete documents directory. how clear nsdocumentsdirectory can find here if want delete files inbox use same code adding ... nsstring *path = [nsstring stringwithformat:@"%@/inbox", documentsdirectory ]; nsarray *directorycontents = [filemgr contentsofdirectoryatpath:error:&error]; ... read reference from apple doc: use directory access files app asked open outside entities. specifically, mail program places email attachments associated app in directory; document

Using a pre-defined method to change a property of an object Javascript -

i have function defined before object created. pre-defined function uses 'this' keyword change value of property in object. inside object have method calls predefined method 1 argument. after calling method , try print value of property supposed changed, still remains same. how fix this? var setname = function(yourname){ this.name = "your name " + yourname; }; // create object called `human` var human = { name: "nothing here yet", sethumanname: function(name) { setname(name);//name should changed } }; human.sethumanname("emeka"); console.log(human.name); //this not print new value of name just use var human = { name: "nothing here yet", sethumanname: setname // no invocation, assigning function }; for explicitly invoking arbitrary functions on object (so this keyword set object) use call method of function.

Google Apps Spreadsheet open specific sheet based on current date (Month) -

i creating spreadsheet in google apps used log client attendance. spreadsheet contains 12 sheets. each sheet represents month of year sheet 1 represents january, sheet 2 represents february etc. i trying create google apps script using on_open function automatically open relevant sheet based on current date. for example if current date 18/02/2013 spreadsheet automatically open sheet 2 (february) in focus. i think correct in using spreadsheetapp.setactivesheet don't know how capture date month google app script. i assuming script flow bit following? if date = 18/02/2013 spreadsheetapp.setactivesheet 2 any gratefully received. to month number, 0 - 11: var month = (new date()).getmonth(); assuming have { sheet1 .. sheet12 } representing january - december, work: /** * selects monthly sheet */ function onopen() { var month = (new date()).getmonth(); var ss = spreadsheetapp.getactivespreadsheet(); var sheet = ss.getsheets()[month]; ss.setacti

Ruby gem for audit request params -

is there ruby gem available getting request object values? need save particular values request object rails db. values below request.headers['http_user_agent'] request.headers['query_string'] request.headers['original_fullpath'] request.remote_ip request.remote_addr i need save these values particular page loaded everytime in rails db. know can directly request object. doing via gem may simplify work.

Toggle siblings with jquery -

i have problems toggle() in jquery. see http://jsfiddle.net/rch7l/ . when clicking level-1 header should, when clicking level-2 header opens level-3 row , not level-3 rows under level-2 header. $('tr.level-2, tr.level-3').css("display", "none"); $("tr.level-1").click(function(){ $(this).siblings('tr.level-2').toggle(); }); $("tr.level-2").click(function(){ $(this).siblings('tr.level-3').toggle(); }); i've tried using siblings(), not want when clicking level-2 headers. simply use .nextuntil() method live demo $("tr.level-2").click(function(){ $(this).nextuntil('tr.level-2').toggle(); });

java - Different resuls when multiplying -

i have following code , output: public static void main(string[] args) { long lon = 1000; lon = lon * 3600; lon = lon * 24; lon = lon * 365; system.out.println("lon: " + lon); long lon2 = 1000 * 3600 * 24 * 365; system.out.println("lon2: " + lon2); } lon: 31536000000 lon2: 1471228928 i guess kind of overflow occurring lon2 , can't seem figure out. result way below long.max_value. idea? java isn't smart enough guess intent here. your problem you're multiplying int s overflow occurs. every number in calculation int , result of int . on assignment resulting int converted long , it's late. so use like long lon2 = 1000l * 3600 * 24 * 365; to make sure whole calculation done in long s. or, safe, affix l on every literal there. makes intent clear :-)

javascript - How to check whether the checkboxlist is checked atleast one in Struts2? -

i'm working in struts2 framework. have checkboxlist in code. <div id="mycheckbox"> <td> <s:checkboxlist theme="simple" name="claimlistview.claimstatus" list="#{'u':'unprocessed', 'p':'processed','r':'routed','s':'sent'}" id="claimstatus" required="true" value="defaultcolor"/> </td> </div> so want field required field. mean user should select @ least 1 check box. else error msg should throwed , prevent form submitted. how can achieve ? i tried in jquery given below code. var n = $("#mycheckbox input:checked").length; alert("the count : "+n); if (n>0) { return true; } else{ return false; } i know i'm missing something. can me, i'm getting wrong ? finally found out solution own question. below script working fine. var n = $('input[name="claimlist

android - nullpointerexception getSharedPreferences -

i trying save preferences within android app. when trying sharedpreference getting nullpointerexception. error: 04-25 13:58:44.814: w/system.err(22795): java.lang.nullpointerexception 04-25 13:58:44.824: w/system.err(22795): @ com.koeriers.standaard.sharedpreferences.setdata(sharedpreferences.java:27) 04-25 13:58:44.829: w/system.err(22795): @ com.koeriers.standaard.actlogin.oncreate(actlogin.java:79) 04-25 13:58:44.834: w/system.err(22795): @ android.app.activity.performcreate(activity.java:5206) 04-25 13:58:44.839: w/system.err(22795): @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1094) 04-25 13:58:44.844: w/system.err(22795): @ android.app.activitythread.performlaunchactivity(activitythread.java:2074) 04-25 13:58:44.849: w/system.err(22795): @ android.app.activitythread.handlelaunchactivity(activitythread.java:2135) 04-25 13:58:44.854: w/system.err(22795): @ android.app.activitythread.access$700(activitythread.java:140) 04-25 13:5

c# - No parameterless constructor defined for this object. ASP.net MVC4, with NHibernate -

this code work fine on colleague's machine, when run code on mine gives me "error no parameterless constructor defined object". if add parameterless constructor works me, see in bellow code public actionresult user_read([datasourcerequest] datasourcerequest request) , gives me error "object reference not set instance of object." in block. return json(repository.all() .select(s => new userviewmodel() { id = s.id, username = s.username, email = s.email, roleid = s.role, locked = s.locked, createdat = s.createdat, updatedat = s.updatedat }).todatasourceresult(request)); using kendo.mvc.ui; using mhusa.pricing.core.domain; using system; using system.collections.generic; using system.linq; using system.web.mvc; using kendo.mvc.extensions; using mhusapricingri.webui.models; using mhusa.pricing.core; namespace mhusapricingri.webui.controllers { public class usercontroller : controller

Upgrading to spring 3.2.2 from 3.0.4, RequestBody String is getting escaped -

we upgraded spring 3.2.2 3.0.4. after upgrading noticed "requestbody" parameter in our controller function escaped or urlencoded. updated schemalocation 3.2.xsd spring-beans , spring-mvc. for example in controller function below @requestmapping(value = "/getfunnyfilters", method = requestmethod.post) public modelandview getfunnyfilters(@requestbody string body, httpsession session) { value of body in 3.0.4 {"selectedfilters":{"values":[]}} whereas in 3.2.2 %7b%22selectedfilters%22%3a%7b%22values%22%3a%5b%5d%7d%7d= are missing settings or default behavior in 3.2.2. input appreciated. thanks

how to create Google map in android -

i new in android.i need create google map.i try create google map in emulator drive android-sdk-windows\add-ons\addon-google_apis-google-16\samples\mapsdemo 1) added map,effect , usbs jar file in libs folder. 2) added permission <uses-permission android:name="android.permission.access_coarse_location" /> <uses-permission android:name="android.permission.internet" /> but come error code error: 04-25 18:00:00.857: e/androidruntime(2339): fatal exception: main 04-25 18:00:00.857: e/androidruntime(2339): java.lang.runtimeexception: unable start activity componentinfo{com.example.androidmap/com.example.androidmap.mainactivity}: android.content.activitynotfoundexception: unable find explicit activity class {com.example.androidmap/com.example.androidmap.mapsdemo}; have declared activity in androidmanifest.xml? 04-25 18:00:00.857: e/androidruntime(2339): @ android.app.activitythread.performlaunchactivity(activitythread.java:205

SQL query: find each item that costs more than the average and how much more -

i'm doing revision databases exam , 1 of questions follows: given table items (columns: itemid , description , unitcost ), formulate query find each item costs more average , how more average costs. my answer far select itemid, description, unitcost - avg(unitcost) items unitcost > (select avg(unitcost) items) would work? understand, expressions allowed in list of selected columns i'm not sure if extends use of functions avg() . is there cleaner, clearer way express same thing? preferably using iso sql constructs because course rather theoretical , not connected specific dialect. thanks friends :) one query should work version of sql (that accepts explicit join syntax) be: select i.itemid, i.description, i.unitcost - a.avg_cost cost_diff (select avg(unitcost) avg_cost items) join items on i.unitcost > a.avg_cost

java - Unable to instantiate activity- ClassNotFoundException -

my android application throws classnotfoundexception exception. this code in mainactivity.java: package pl.advancedsoftware.manga; public class mainactivity extends fragmentactivity { viewpager viewpager; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); requestwindowfeature(window.feature_indeterminate_progress); setcontentview(r.layout.activity_main); favourites.context= getapplicationcontext(); sectionspageradapter sectionspageradapter = new sectionspageradapter(getsupportfragmentmanager()); viewpager= (viewpager)findviewbyid(r.id.pager); viewpager.setadapter(sectionspageradapter); } @override public boolean oncreateoptionsmenu(menu menu) { // getmenuinflater().inflate(r.menu.activity_main, menu); return true; } } in androidmanifest.xml: <manifest xmlns:android="http://schemas.android.com/apk/res/android&qu

ajax - How to use native javascript write jquery $.getJSON function? -

a demo want use jquery $.getjson function,but must import jquery, want use native javascript write jquery $.getjson function. my code is: var $={ getjson: function(url, params, callback){ var requrl = url; var xhr = new xmlhttprequest; xhr.onreadystatechange = function() { if (xhr.readystate == 4 && xhr.status == 200) { json.parse(xhr.responsetext); } } xhr.open("get", requrl); xhr.send(); } }; use chrome show: xmlhttprequest cannot load xxxx origin xx not allowed access-control-allow-origin. who can me? make ajax request , use json.parse on result. like: xhr = new xmlhttprequest; xhr.onreadystatechange = function() { if (xhr.readystate == 4 && xhr.status == 200) { json.parse(xhr.responsetext); } } xhr.open("get", url) xhr.send();

visual studio 2010 - Cannot find svn.exe on C# build -

so i've checked out project in svn using tortoise(latest version), , whenever build message "cannot find svn.exe! please make sure it's installed in path". don't know what's going on, other projects have checked out aren't doing this. your build uses command-line svn client somewhere in custom build step. either remove or install command-line client.

java - How to add a color indicator (LED-lookalike) to a JFrame? -

i want add color-indicator jframe. should turned red when click button , if not click button should green. how should implement this? jlabel lblled = new jlabel("•"); lblled.setforeground(color.green); add changelistener jbutton , in statechanged() method add this: if (buttonispressed) { lblled.setforeground(color.red); } else { lblled.setforeground(color.green); }

compression - Uncompress, edit, compress and concatenate files -

i have bunch of large compressed files want concatenate. problem is, don't have newline characters @ end of uncompressed version, if try cat them , work on them compressed, last line in 1 file joined first line in next file (which throws error software i'm using). cat'ing them new-line inserted between each compressed file doesn't work think gzip detects newline character , thinks after 'trailing garbage'.e.g. for f in *.gz; (cat "${f}"; echo) >> all.gz; done; gzip -d all.gz gzip: all.gz: decompression ok, trailing garbage ignored what i'd this: unzip file1.gz | add newline char| gzip output >> output.gz and same file2.gz, file3.gz, etc., etc. any suggestions? you don't need decompress , recompress. compress one-byte new-line character gzip, , concatenate between large gzip files. echo | gzip > newline.gz cat file1.gz newline.gz file2.gz newline.gz file3.gz ... > file.gz it 21-byte file insert eac

javascript - How to get the id of the textbox on keydown event of that textbox -

i have text box in page: <td> <input type="text" id="approvers1" size="11" onkeydown="adduserskeydown(event)" style="width: 470px;" /> </td> this js function: function adduserskeydown(evtobj) { if (evtobj.keycode == 75 && evtobj.ctrlkey) { addusers(--input parameter--); } } now if press ctrl k in textbox must call javascript function named addusers(--input parameter--).. input parameter should id of textbox ... how achieve this.. either need id of textbox or atleast dom object can access id of textbox dom object.. kindly me in achieving either 1 of 2 things.. use this dom element or this.id id of element <td> <input type="text" id="approvers1" size="11" onkeydown="adduserskeydown(event,this.id)" style="width: 470px;" /> </td> function adduserskeydown(evtobj,id) { if (evtobj.keycode == 75 &

Change default icon creating a new Android Eclipse project -

Image
does knows how change default icon embbeded here? in order all new applications create has icon instead android default one . i tried /android-sdk-linux/platforms/android-[version]/data without success. :( named ic_launcher.png? thanks in advance! edit: please read before vote or answer. not how change icon app, q how make default new projects. :) for interest of everyone: the default icons in path: /eclipse/plugins/com.android.ide.eclipse.adt_xxxxx.jar/templates/ here can define new default package , header activities.

How to calculate SNR of signals in MATLAB? -

i've encountered simple, yet fundamental problem on calculating snr: there several signals : s1 = original , pure clean signal without noise. n1 = white gaussian noise going added s1. s2 = s1 + n1 (the noisy signal before performing noise-reduction algorithm) s3 = noise-reduced signal (after performing noise reduction algorithm) n2 = s3 - s1 (the amount of noise after performing noise-reduction algorithm) now want compare snr before , after performing noise-reduction algorithm. which signals should consider snr_before!? s1/n1 or s2/n1 ? which signals should consider snr_after!? s3/n1 or s3/n2 ? which commands or functions should use in matlab in order compute snr_before , snr_after? thanks billion putting time on helping me. what know calculating snr before : snrbeforenoise = mean( signal .^ 2 ) / mean( noise .^ 2 ); and snr after : residual_noise = signal - noise_reduced_signal; snr_after = mean( signal .^ 2 ) / mean( residual_noise .^ 2

sql server - Incorrect value being passed in to SQL from .NET sqlcommand -

why when run below code, should insert value of 122387593.6 table, insert value of 122387593.59999999? i have traced call made .net , can see value being passed in 122387593.59999999 sql, yet while debugging parameter value returned 122387593.6?! i have not been able work out why .net doing - appreciated. ---sql code create table [dbo].[tblnum]( [num] [numeric](28, 8) not null ) on [primary] create procedure spnuminsert (@num numeric(28,8)) begin insert tblnum values(@num) end go --.net code dim = double.parse("122387593.6", globalization.cultureinfo.invariantculture) dim con sqlconnection = new sqlconnection("server=server;database=database;trusted_connection=true;") dim com sqlcommand = new sqlcommand("spnuminsert", con) com.commandtype = commandtype.storedprocedure com.parameters.add(new sqlparameter("@num", a)) con.open() com.executenonquery() con.close() con.d

ruby on rails - Flow for downloading and unzipping files for Heroku and S3? -

i'm working apple's itunes epf data files. i'll daily need download, unzip , process 1-3gb of data in .tbz files every day. i've got rails app, hosted on heroku, asset storage being taken care of on s3. but i'm having trouble flow getting epf files apple. there 3 files i'll downloading. each .tbz files varying in size 1gb down ~20mb. heroku doesn't have way reliable store files, assume need download files directly s3? somehow unzip them there? that's i'm hitting snag. know how files apple , on s3, decompressing them i'm not following. and since data files can pretty large, minimizing transfer on s3 critical keeping costs down. is there service can let me download apple files servers, decompress, , upload s3 necessary files? heroku's file system ephemeral , can still write out /tmp temporary scratch space download, unzip, whatever processing need, re-package (if needed), , uploaded s3. because of automatic dyno rest

javascript - General: Does Kinetic.js provide painting of specific pixels? -

this general question kinetic.js developer processing/processing.js background. when using processing.js, routinely set color value of specific pixel on canvas. set(x, y, color); very easy can see. in situation, each y-value, value x may have different color value (or not @ all). when @ kinetic.js, see object , closest can find drawing pixel 1x1 kinetic.rect. seems intensive if have, example, 1,000 kinetic.rect objects per y-value. in addition, not need each pixel "object", per se. though, other benefits of kinetic.js, such layering , better transition , animation control. does kinetic.js provide means more direct pixel painting , manipulation, ala processing.js? thank you.

c++: a class accessing an std::vector of main class by pointers goes wrong -

Image
i'm building c++ project vs2012 express, platform toolset v100, , openframeworks 0.7.4. i have class called namerect , part of .h file: void config(int cx, int cy, int cw, int ch, std::string cname) { x = cx; y = cy; w = cw; h = ch; name = cname; dead = false; } void branch(int iterants, std::vector<namerect> *nrs) { (int = 0; < iterants; i++) { namerect nnr; nnr.config(x + w, y - iterants * h / 2 + * h, w, h, "cb"); children.push_back(nnr); nrs->push_back(nnr); } } void render() { if (!dead) { ofsetcolor(ofrandom(0, 255), ofrandom(0, 255), ofrandom(0, 255), 0); ofrect(x, y, w, h); } } and there's code in testapp.cpp : //-------------------------------------------------------------- void testapp::setup(){ ofsetwindowshape(800, 600); nr.config(0, 300, 50, 10, "cb"); nrs.push_back(nr); } //-----------------------------------------

TYPO3: could BE users only see the records they created? -

is possible, extension or else, make user see records-types, if such records have been created them themselves? what kind of records? if example news, or other records extension, easiest way create separate sysfolder every user can use web > access module disable/enable visibility. if want on 1 page display different records different users rather difficult without writing own module. if have few beusers - manually, otherwise i'd suggest writing module. tip: looks extbase allows easier creating of modules oldschool pi- way (my personal experience).

knockout.js - Why isn't my knockout observable property, and boud input field being updated? -

i have object observable properties. this.usertoadd = { id: ko.observable(""), firstname: ko.observable(""), lastname: ko.observable(""), active: ko.observable(""), email: ko.observable(""), roles: ko.observablearray([]) }; i attempt update object when button clicked $(document).on("click", ".edit", function () { var itemtoupdate = ko.datafor(this); if (itemtoupdate.id !== undefined) { //update observable vm.usertoadd.id = itemtoupdate.id; vm.usertoadd.firstname = itemtoupdate.firstname; vm.usertoadd.lastname = itemtoupdate.lastname; vm.usertoadd.email = itemtoupdate.email; vm.usertoadd.active = itemtoupdate.active; vm.usertoadd.roles = itemtoupdate.roles; //update form, , there must better way $('input[name="id"]').val(itemtoupdate.id); $('input

How can I Filter all records where same id's Time differ a few seconds sql server -

this select statement data between dates: select distinct events.clock,events.tagid events (datediff(second, events.clock, '2013/04/20') <= 30) , (datediff(second, events.clock, '2013/04/21') >= 30) order events.tagid desc this results statement. | clock | tagid | --------------------------------------------- 1 | 2013-04-20 12:39:18 | 4cb0000060032 | 2 | 2013-04-20 12:39:16 | 4cb0000060032 | 3 | 2013-04-20 16:53:09 | 4cb0000060032 | 4 | 2013-04-20 13:22:38 | 4cb00000600ef | 5 | 2013-04-20 13:22:40 | 4cb00000600ef | 6 | 2013-04-20 15:20:56 | 4cb00000600d2 | 7 | 2013-04-20 15:17:31 | 4cb00000600d2 | 8 | 2013-04-20 15:20:58 | 4cb00000600d2 | 9 | 2013-04-20 19:33:09 | 4cb00000600d1 | 10 | 2013-04-20 20:39:16 | 4cb00000600d1 | 11 | 2013-04-20 11:10:38 | 4cb00000600d1 | now filter results more because can see there records time differ in milliseconds , others in

Instant search in django application -

i using django in windows i giving text field search name of category, text box should give me name result google instant by selecting name, should give me details of category in same page itself . any body can me out. check out django-ajax-search should solve problem

d3.js - set links size to a force layout -

Image
based on "molecule" example of michael bostock, available @ url : http://bl.ocks.org/mbostock/3037015 . i'm trying set size of links several values. that, disabled "gravity", put important negative value in "charge" , fixed first node center of window. var force = d3.layout.force() .size([width, height]) .charge(-800) .friction(0.45) .linkstrength(1) .gravity(0) .linkdistance(function(d) { return radius(d.target.size * 10); }); my problem ( ) size of links differents, links defined little value. does know 1 solution problem? you can see code here : http://jsfiddle.net/awpn3/ it's characteristic of force layout length of links variable -- point nodes laid out automatically , don't have worry it. implement checks make sure distances want them be, quite difficult. the linkdistance function you're using direct way (weakly) enforce such constraint. if that's not enough, there

How can I do a query for this report in sql server? -

Image
i have tables "cashmovementtbl","salestbl" & "expensestbl" include data that: and want show data such following: so how can query in sql server show data that. select c.cashdate, isnull(s.billno,e.expnstype) details, case when c.saleid not null thne c.amount else 0 end [in], case when c.expenseid not null thne c.amount else 0 end [out] cashmovementtbl c left join salestbl s on c.saleid = s.salesis left join expensenstbl e on c.expenseid = e.expnsid

Rails ContactUs model in single pages controller -

hi have simple rails site no models, used serving static pages. the site has pages controller, serving 1 home page made of partials. like such in app/views/pages/home.html.erb <%= render 'layouts/about' %> <%= render 'layouts/services' %> <%= render 'layouts/rooms' %> <%= render 'layouts/breakfast' %> <%= render 'layouts/guestbook' %> <%= render 'layouts/contact' %> the home page uses html5/javascript autoscrolls page. each section prefaced # allow auto scrolling section. <li><a class="home" href="#home">home</a></li> <li><a class="services" href="#services">tarrifs</a></li> <li><a class="portofolio" href="#portofolio">rooms</a></li> <li><a class="breakfast" href="#breakfast">breakfast</a></li> <l

java - Android JavaScript Bridge - Trigger Events -

probably simple question, can call native function javascript, example: android.setvolume(0.7) however, not know how trigger (from android/java), or handle events (js) not caused user interaction, example, alerting js when user's network state changes, battery gets below point etc. any appreciated. however, not know how trigger (from android/java), or handle events (js) not caused user interaction, example, alerting js when user's network state changes, battery gets below point etc. as answer linked to, use loadurl() javascript: url, akin how bookmarklet works. the answer on year old , labelled hack, still best way it? i not clear why author of answer described hack. certainly, it's viable , used fair bit.

sublimetext2 - A Sublime Text extension to show PHP warnings and errors -

i installed sublime text 2 recently, , i'm still adapting. i've installed package control , of php extensions. wish 1 underline syntaxes errors, netbeans does. there package can this? use sublimelinter (it checks php syntax using php -l ).

android - How to preserve the ending values of an animation? -

i use api 10 . have imageview nested inside of linearlayout . imageview has onclicklistener (or ontouchlistener , i'm sure 1 ll use @ end). imageview centered on screen, , when clicked performs following animation. <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" android:fillenabled="true" android:fillafter="true" > <alpha android:fromalpha="1" android:toalpha="0" android:duration ="500" /> <translate android:fromxdelta="0%" android:toxdelta="-100%p" android:duration ="1000" /> </set> the problem after animation ends, returns first position, faded out 0, still clickable if doesn't show up. click on empty space imageview first positioned, , performs the animation again. clicking ghost. how make i

c# - Best way to check if any value exists on ArrayList -

i have arraylist . want check if value exits in t arraylist . use method (from system.linq namespace), can use on array , not arraylist . is there efficient way check this? well, check .count > 0 . better option stop using arraylist . since know any() , system.linq , assume you're not using .net 1.1; use list<t> t , , problems solved. has full linq-to-objects usage, , better idea. list<int> myints = ... bool anyatall = myints.any(); bool anyevens = myints.any(x => (x % 2) == 0); // etc

Rails 4 raw html_safe not working -

i not able escape raw html tags in view <% array = @article.tags.collect { |p| (link_to p.name, '#') } %> <%= array.join(' , ') %> raw , html_safe <% array = @article.tags.collect { |p| raw (link_to p.name, '#') } %> <% array = @article.tags.collect { |p| (link_to p.name, '#').html_safe } %> giving me output, without escaping html tags <a href="#">tag1</a> , <a href="#">tag2</a> , <a href="#">tag4</a> this solved problem <%= raw (@article.tags.map { |p| (link_to p.name, '#') }.join(' , ')) %>

ruby on rails - Why is this form redirecting me before giving me a chance to enter data? -

rails controller: class venuescontroller < applicationcontroller def new @venue = venue.new end def create @venue = venue.new(params[:venue]) if @venue.save redirect_to root_path end end def update redirect_to search_path end end rails form: <%= form_for(@venue) |f| %> <%= f.text_field :foursquare_id %> <%= f.submit "save" %> <% end %> "foursquare_id" column in "venues" table. import foursquare id foursquare i'm typing in text testing purposes. being redirected "root_path" before being given chance type form. what controller/form missing? thank in advance the template form should used new action new.html.erb filename. , should going /venues/new fill out form. the create action used submit completed form, why getting redirected. should modify create handle model couldn't save: def create @venue = venue.new(params[:venue]) if @v

android - Enigmatic NullPointerException -

i'm getting following null pointer exception. whenever click on button(which i've intent launch) . fc , nullpointer exception. because of use of text file? logcat 04-25 20:02:40.762: i/adreno200-eglsub(29671): <configwindowmatch:2081>: format rgba_8888. 04-25 20:02:40.772: d/memalloc(29671): /dev/pmem: mapped buffer base:0x514e1000 size:3649536 offset:3035136 fd:56 04-25 20:02:40.982: d/memalloc(29671): /dev/pmem: mapped buffer base:0x51b08000 size:4325376 offset:3710976 fd:59 04-25 20:02:41.632: i/adreno200-eglsub(29671): <configwindowmatch:2081>: format rgba_8888. 04-25 20:02:41.632: d/memalloc(29671): /dev/pmem: mapped buffer base:0x5212e000 size:4939776 offset:4325376 fd:62 04-25 20:02:41.692: d/memalloc(29671): /dev/pmem: mapped buffer base:0x52615000 size:5554176 offset:4939776 fd:68 04-25 20:02:41.712: d/memalloc(29671): /dev/pmem: unmapping buffer base:0x514e1000 size:3649536 offset:3035136 04-25 20:02:41.712: d/memall

linq - DynamicLinq C# not working in join -

i using in c # projects dynamiclinq. when simple select using "order by", "skip", etc. works perfectly. but if join restona simple error: error 3 instance argument: cannot convert 'int?' 'system.linq.iqueryable' j:\c#\erp\erp\helpers\listagempadrao.cs 23 25 erp error 2 'int?' not contain definition 'orderby' , best extension method overload 'system.linq.dynamic.dynamicqueryable.orderby(system.linq.iqueryable, string, params object[])' has invalid arguments j:\c#\erp\erp\helpers\listagempadrao.cs 23 25 erp sql work: var lista = in db.usuario.asqueryable() .orderby(aorderna + " " + aordenatipo) .skip(ainiciarnoregistro) .take(aqtderegistro) select new { a.usuarioid, a.nome, a.login, a.email }; sql not work: var lista = in db.usuario.asqueryable() join b in db.usuarioacesso.asquery

c# - When a property is changed several times very quickly, how many PropertyChanged events are sent? -

i have code implements propertychanged event (similar snippet below). private void sendpropertychanged(string propertyname) { if(propertychanged != null) { propertychanged(this, new propertychangedeventargs(propertyname)); } } i noticed event handler called once, when same property changed several times quickly. can't find documentation mentions this. can confirm if expected behaviour propertychanged? remember c# event not more function call. there 2 main differences regular function call: - with events, callee has dependency on caller, rather other way around. the event can have invocation list, is, multiple callees can attached single caller. there no throttling built event raising mechanism, effect you're seeing must have different explanation.

koneki - Way to write code "in the debugger" in Lua? -

i played around bit lua , tried koneki eclipse plugin, quite nice. problem when make changes in function i'm debugging @ moment changes not become effective when saving changes. i'm forced restart application. nice if make changes in debugger , become effective on fly example smalltalk or extend in hot code replacement in java. has clue whether possible? it possible degree limitations. i've been developing ide/debugger provides functionality. gives access remote console execute commands in context/environment of running application. ide supports live coding , reloads modified code make changes it; see demos here . the main limitation can't modify running function (at least without changes lua vm). means effect of changes running function seen after exit , re-enter function. works environments call same function repeatedly (for example game engine calling draw ), may not work in case. another challenge dealing upvalues (values created outside of functio

Using multiple variables across multiple functions in C# -

i'm trying write program interface i/o card. hardware's provided documentation in c# , have never used c# before. so, pardon me if question seems basic or elementary. using manufacturer's functions calls @ least 3 variables per i/o pin , there 55 pins. means lot of defined variables. writing code, finding ugly. reusing snippets here , there made function. making them function, lose ability access multitude of variables. there simple way this? here shortened version of working with. missing pieces same. i'm using vs2012. in advance. using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; using system.threading; /* tool changer controller program * in theory, program run tool changer through full cycle. * includes: removing current tool, * placing current tool in appropriate location on carousel, * moving carousel correct location of new tool, *