Posts

Showing posts from January, 2011

javascript - ngRepeat track by: How to add event hook on model change? -

i have simple ngrepeat following: <some-element ng-repeat="singlerecord in arrayofrecords track singlerecord.id"> <!-- stuff --> </some-element> arrayofrecords updated server , may contain new data. ngrepeat 's track by feature can figure out when new element added array , automatically updates dom without changing existing elements. hook code , execute callback function when there's new data coming in or old data removed. possible via angular? from understand, there's $$watchers triggers callbacks whenever there's changes variables, don't know how go hacking that. right direction? note: know can manually save arrayofrecords , compare new values when fetch them see changed. however, since angular offers track by feature has logic, nice if can have angular automatically trigger event callback when element added or removed array. doesn't make sense duplicate logic exists in angular. probably create dire...

php - copy values to another mysql database -

i have table displays fields sent form. there buttons can edit or delete selected row selecting id. want add button insert selected row table. cannot work. here's code table: <?php /* view.php displays data 'players' table */ // connect database include('config2.php'); // results database $result = mysql_query("select * articles") or die(mysql_error()); // display data in table echo "<table border='1' cellpadding='10'>"; echo "<tr> <th>author</th> <th>email</th> <th>title</th> <th>poem</th> <th>id</th>"; // loop through results of database query, displaying them in table while($row = mysql_fetch_array( $result )) { // echo out contents of each row table echo "<tr>"; echo '<td>' . $row['name'] . '</td>'; echo '<td>' . $ro...

bash - Determine Deployment Group from appspec.yml -

i using elb scripts https://github.com/awslabs/aws-codedeploy-samples/tree/master/load-balancing/elb remove ec2 instances load balancer before code updates. i need define load balancer in elb_list variable of common_functions.sh bash script. load balancer different each environment (or deployment group). is there way can set variable based on deployment group deploying within bash script? the application artifacts same, deployed different environments or groups , hence, different load balancers. well then, after searching forums on aws, see support deployment specific environment variables. so can reference deployment group within bash , set load balancer: if [ "$deployment_group_name" == "staging" ] elb_list="staging-elb" fi re http://blogs.aws.amazon.com/application-management/post/tx1px2xmplypuld/using-codedeploy-environment-variables

vb.net - (415) Unsupported Media Type while posting envelopes in DocuSign -

i getting error while trying post envelope: (415) unsupported media type here code: dim httpwebrequest = directcast(webrequest.create("https://demo.docusign.net/restapi/v2/accounts/1005732/envelopes"), httpwebrequest) httpwebrequest.contenttype = "text/json" httpwebrequest.method = "post" httpwebrequest.accept = "text/json" httpwebrequest.mediatype = "text/json" httpwebrequest.headers.add("x-docusign-authentication", "{""username"": ""myuser"",""password"": ""mypassword"",""integratorkey"": ""mykey""}") using streamwriter = new streamwriter(httpwebrequest.getrequeststream()) dim json string = "{""status"": ""sent"",""emailblurb"": ""test email body"",""emailsubject"": "...

Sorting XML based on several sub-elements using XSLT -

i'm trying sort xml (using xslt) based on few child elements , return result xml. know it's not difficult first experience using xslt , it's giving me troubles. here's xml: <root> <subject> <coursesubjectheader> <subjectcode>b</subjectcode> <subjectname>text</subjectname> <unit>text</unit> <faculty>text</faculty> </coursesubjectheader> <course> <crslevel>text</crslevel> <subjectandnumber>b 200</subjectandnumber> <units>3.0</units> <hours>3-0</hours> </course> <course> <crslevel>text</crslevel> <subjectandnumber>b 100</subjectandnumber> <units>3.0</units> <hours>3-0</hours> </course> </subject> <subject> <coursesubjectheader> <subjectco...

java - Javafx - How to Add Pie Chart to BorderPane from Different Class -

i have 2 classes. main class , chart class. chart class extends piechart , instantiates pie chart in constructor. main class creates borderpane, instantiate object of chart class(creating pie chart) , add center pane.the problem don't know exact syntax make work properly, in constructor of chart class. i know example, if creating hbox instead of pie chart in constructor, use this. , number of methods. pie charts have additional elements observable lists i'm not sure how make work? here 2 classes below. please help. thank you. main class public class main extends application { @override public void start(stage primarystage) { borderpane border = new borderpane(); chart chart = new chart(); border.setcenter(chart); scene scene = new scene (border, 640,680); primarystage.setscene(scene); primarystage.show(); } public static void main(string[] args) { launch(args); }} chart class public class chart extends piechart{ public chart(){ ...

c# - Mapping stored procedures in EF 6 to abstract types -

my data model uses inheritance (which i'm trying change...) looks like: abstract class entity { public int foo { get; set; } } class derived1 : entity { public int widgetcount { get; set; } } class derived2 : entity { public int barcount { get; set; } } i retrieve results of query (or stored proc) returns entity, .executestorecommand<t> .translate<t> , .sqlquery<t> fail because can't create entities, yet query against dbcontext's dbset<entity> works , returns objects of correct type (either derived1 or derived2). is there way me query entities without using dbset?

php - JMSSerializerBundle, Deserialize doesn't Relationship After Persist -

deserialization process onetomany-manytoone process relation data sets null. the result entity: @orm\onetomany(targetentity="\acme\demobundle\entity\answercontent", mappedby="answerresult", cascade={"persist", "remove"}, orphanremoval=true) @jms\type("arraycollection<acme\demobundle\entity\answercontent>") @jms\groups({"survey_answer_fetching"}) the answer entity: @orm\manytoone(targetentity="acme\demobundle\entity\answerresult", inversedby="answers") @orm\joincolumn(name="answer_result_id", referencedcolumnname="id") @jms\type("acme\demobundle\entity\answerresult") here json: {"results": [{"answers":[ {"choices":[{"fieldid":1}],"value":"","questionid":45}, {"choices":[{"fieldid":1}],"value":"","questionid":67}], "someid":9...

Git detects directory with extension as file -

i'm using git repository, for strong reason, i've got folder called name.gid files inside. when git add . it's added file (because of extension?) none of inner files added. is there way specify git name.gid folder? after git commit can use git ls-files . check files in repository.

php - Get only the filename from a path -

i have string $string = 'c:\folder\sub-folder\file.ext'; i want change to: $string = 'file.ext'; using php, trying write method ignores left of last \ . use basename() str_replace() \ in path is not recognized basename() $filename = basename(str_replace('\\', '/', 'c:\folder\sub-foler\file.ext')); echo $filename; // file.ext demo

random.choice gives different results on Python 2 and 3 -

background i want test code depends on random module. the problematic pr https://github.com/axelrod-python/axelrod/pull/202 , code here https://github.com/axelrod-python/axelrod/blob/master/axelrod/strategies/qlearner.py the problem since random module produces pseudo-random numbers, set random.seed(x) known value x . works consecutive test runs. however, python 3 seems give different numbers python 2 when using random.choice([d, c]) following snippet: import random random.seed(1) in range(10): print(random.choice(['c', 'd']), end=', ') gives different result python 2 , 3 $ python2 test.py c, d, d, c, c, c, d, d, c, c $ python3 test.py c, c, d, c, d, d, d, d, c, c however, random.random method works same on 2.x , 3.x: import random random.seed(1) in range(10): print(random.ran...

Unable to parse XML from PHP -

i not able find same problem,ihave issue below.the target show xml attributes values using soap message.php code looks like: $client = new soapclient("https://domain.com/xml/listener.asmx?wsdl"); $getresults = $client->getfab(array('username' => "anyuser", 'password' => "anypassword", 'code' => "1108324")); print_r($getresults); the xml soap ui using same request has different structure: <soap:envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema"> <getjobresponse xmlns="http://www....> <getjobresult> <number>79593</jobnumber> <status>invoiced</jobstatus> <code>cb0071</thirdpartycode> > <fin seq="422"> <...

geometry - How do I enlarge a shape while ensuring the original will fit inside it concentrically? -

i have islands in game defined array of vertices. create larger version of them make type of "shore", cosmetic purposes, while keeping original shape intact use collision purposes. have tried dilating point point , moving larger shape has same center original, doesn't seem work concave shapes 1 below. enlargement process wouldn't have perfect dilation because shore cosmetic, prefer have shape of defined in code instead of using sort of visual effect. it seems reputation low post images, please see example below: http://i.stack.imgur.com/4hwuj.jpg sorry if unclear; it's hard put words. basically, seems, dilating shape doesn't mean smaller 1 can fit inside larger one. need enlargement process can ensure that. you trying inflate shape, has been answered before: inflate/deflate discussion

excel - After editing macro code, the short cut to macro no longer works -

yesterday asked macro code. receive needed , code works great - 1 exception - now, no matter do, shortcut used use no longer works. the keyboard shortcut ctrl+q. doesn't work , nothing happens when hit keyboard combo. tried saving different letter fails too. any ideas how shortcut work again? from view tab, select macros button , view macros . macro on list displays, single-click it, click options... button. this shows dialog box need. shortcut key assigned macro (presumably none, based on description) shown, , can type whatever letter like. don't forget assigning lower-case letter makes shortcut ctrl- letter while using upper-case letter makes ctrl-shift- letter .

Part order by in mysql -

id | datetime how can order id, bump recent 2 dated rows positions 1 , 5? i cannot add sort column. is possible sql or need array sorting in php? -------edit id | datetime 1 2000-01-01 00:00:00 2 2000-01-01 00:00:10 3 2000-01-01 00:00:02 4 2000-01-01 00:00:09 5 2000-01-01 00:00:20 6 2000-01-01 00:00:05 i expect out latest 2: ids: 5,2 then rest ordered via id, should like: ids: 5,2,1,3,4,6 in case suggest sort on php side. yes possible create mysql query return order need, not powerful performance perspective http://sqlfiddle.com/#!9/66062/1 select t.* table1 t left join ( select if(@idx null,@idx:=2,@idx:=1) idx, id table1 order `datetime` desc limit 2 ) t1 on t.id = t1.id order t1.idx desc, t.id

Copy local SQL database onto Azure -

Image
i want - should simple - task of copying database local live... i have data , table structure want in local database. i have running database live database has backup stuff assigned etc don't want create brand new database (not can find how either)... i want remove tables database , copy data , tables local live azure sql database. how do this??? you can try achieve sql server management studio.

c# - Best way to work on 15000 work items that need 1-2 I/O calls each -

i have c#/.net 4.5 application work on around 15,000 items independent of each other . each item has relatively small cpu work (no more few milliseconds) , 1-2 i/o calls wcf services implemented in .net 4.5 sql server 2008 backend. assume queue concurrent requests can't process quick enough? these i/o operations can take anywhere few milliseconds full second. work item has little more cpu work(less 100 milliseconds) , done. i running on quad-core machine hyper-threading . using task parallel library, trying best performance machine can little waiting on i/o possible running operations asynchronously , cpu work done in parallel. synchronously, no parallel processes , no async operations, application takes around 9 hours run . believe can speed under hour or less not sure if going right way. what best way work per item in .net? should make 15000 threads , have them doing work context switching? or should make 8 threads (how many logical cores have) , go way? on appreciate...

java - Unable to set env vairables using runtime.exec -

i have execute unix command java program , prior executing command, need set env variables. but unable set env variables because of unix command not success. here code snippet: string[] cmd=new string[] { "/u01/idmtop/products/dir/oid/bin/ldapmodify", "-h ", oid_host, "-p ", oid_port, "-d ", oid_user, "-w ", oid_password, "-c ", "-v ", "-f ", filename}; string[] envp = new string[] { "oarcle_home=" + "/u01/idmtop/products/dir/oid", "instance_home=" + "/u01/idmtop/config/instances/oid1" }; system.out.println(cmd); try { process p; p=runtime.getruntime().exec(cmd, envp); ...

c# - ItemsControl item selection binding -

i have view defined below, <itemscontrol itemssource={binding c1.coll1}> .... <itemscontrol.itemtemplate> <datatemplate datatype="{x:type vm:c2}"> <expander header="{binding name}"> <listbox itemssource={binding coll2}/> </expander> </itemscontrol.itemtemplate> </itemscontrol> the associated view model this, class c1 { public coll1<c2>; } class c2 { public name, public coll2 } i can bind selection event of listbox c2. when event fires want fire c1. alternatives? tried binding selection event c1 did not work. there way bind or there alternatives that? any appreciated. note: please ignore syntax here, trying demonstrate view point minimum code. if interested in full code let me know can share it. the itemssource of itemscontrol already in c1. so need create two-way binding of selecteditem of itemssource property in c1. need c...

java - SQL Database in Android doesnt work -

i'm trying create database 3 columns name, wins, losses. datatable should have 1 line - 1 player. tried not working, app crashes. have 2 activities , 1 regular class. in main activity checks if players name in database , if not asks him enter name. in second activity (gameactivity) supposes show me name , how time won , lost computer. there 2 buttons in there, add win , add loss, each 1 should raise number of wins or losses. sql database class extend sqliteopenhelper mainactivity sqlgametable db; button btn; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); btn = (button) findviewbyid(r.id.leaderboards); db = new sqlgametable(this); if(db.getname() == "") { final score score = new score("", 0, 0); button send = (button) findviewbyid(r.id.btnsend); final edittext et = (edittext) findviewbyid(r.id.edittext1); se...

How to disable the autoloading of a specific module in Linux -

i compiled linux kernel according linux device driver chapter 4: debugging techniques. after loaded first hello world module , checked output dmesg , however, can see evbug: ....... . i know can turn off evbug 's output execute sudo rmmod evbug . but, obviously, inconvenient execute command after each reboot. how disable module's autoloading? want load manually when need it. you need blacklist module. debian systems see https://wiki.debian.org/kernelmoduleblacklisting . redhat systems see https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/installation_guide/rescuemode_drivers-blacklisting.html

tweets - How to set a Twitter account to automatically retweet another account? -

how can set twitter account automatically retweet account? for example, if there main business account 3 subsidiary business accounts below , main account wishes retweet of subsidiary tweets. it great if set in tweetdeck (where 1 can manually). additionally, functionality based on keywords useful.

bit shift - Shifting binary string to a canonical form -

i need compare binary strings consider them same if 1 circular shift of other. example, need following same: 10011, 11100, 01110, 11001 i think it'll easier store them in canonical way, , check equivalence. strings compared has same length (might more 100 bits), i'll keep length unchanged, , define canonical form smallest binary number can circular shift. example, 00111 canonical form of binary strings shown above. my question is, given binary string, how can circular shift smallest binary number without checking possible shifts? if other representation better, i'd happy receive suggestions. i'll add, flipping string doesn't matter, canonical form of 010011 001101 (if described above) if flipping allowed, canonical form should 001011 (which prefer). possible solution compute canonization of string , of flipped string , choose smaller. if helps, i'm working in matlab binary vectors, no need code, explanation of way solve enough, thanks! ...

heroku - rails tutorial chapter 10 sendgrid -

i'm newbie, , self-teaching myself via michael hartl's ruby on rails tutorial . i've made far chapter 10 , have working in development after adding sendgrid push heroko rejected following: nomethoderror: undefined method `action' #<rails::application::configuration:0x007fc6e0b67778> i'm on rails 4.2.0. i'm @ loss wrong. here's production configuration: config.action_mailer.raise_delivery_errors = true config.action_mailer.delivery_method = :smtp host = 'salty-plateau-4554.herokuapp.com' config.action_mailer.default_url_options = { host: host } actionmailer::base.smtp_settings = { :address => 'smtp.sendgrid.net', :port => '587', :authentication => :plain, :user_name => env['sendgrid_username'], :password => env['sendgrid_password'], :domain => 'heroku.com', :enable_starttls_auto => true } and g...

c# - Windows 10 Universal Audio Background Player - unable to register for background task: Run Method Doesn't fire -

developing visual studio 2015 rc - windows 10 universal app background audio player. i have followed following steps. created 3 projects. musicplayer (blank app - windows universal project) playlist (class library - windows universal project) audiobackgroundagent (windows runtime component - windows universal project) followed same steps https://code.msdn.microsoft.com/windowsapps/backgroundaudio-63bbc319 everything ok, except i'm unable register , fire background task run method. please suggest me, steps followed register , fire background task run method. thanks. may need add entry point in package.manifest example here's section need based on similar example: <extensions> <extension category="windows.backgroundtasks" entrypoint="samplebackgroundaudiotask.mybackgroundaudiotask"> <backgroundtasks> <task type="audio" /> </backgroundtasks> </extension> </extensi...

html - Javascript and Chrome's New Tab (and alternate solutions) -

i'm looking either run javascript in new tab of chrome, or alternative. issue here won't run, , i'm stuck, after doing bit of looking. i've searched on here, , there 1 response saying it's not possible, don't understand this. after looking, haven't found more information on matter. as specifics - want toy around making new tab extension chrome, perhaps fledged soon. part of includes clock , other things (at least now), , i've got clock working on normal page if view normally, things annoying. load extension chrome, and.... nothing. point is, i want make new tab replacement chrome uses javascript, , cannot run javascript, simple clock script. now initial information found says javascript not work, here's things appear contradict this: https://developer.chrome.com/extensions/override states: "...in addition html, override page has css , javascript code." nowhere further down see making kind of 'exception' new tab p...

health kit - Background mode (fetch) in iOS 8 -

i'm working on ios app uses background mode post update server. app wakes, checks battery status, kicks off background process , calls completion handler. in exact same order. , works fine. in ios simulator, on development iphones (5s, 6 , 6 plus), seems broken on other iphone i've distributed app too. i'm using hockeyapp (because we're not ready submit app apple) distribute app. i've got correct certificates, i've followed background mode tutorials (for enabling it) , i'm battery friendly. though still background mode works on development iphones , simulator , not on other iphone. does sound familiar anyone? did forget something? did wrong? appreciated, because drives me nuts.. :( stefan ps: i've included code in gist: https://gist.github.com/stefanvermaas/3fd27bbb270e3d1f1fbe

Grouping MarkDown elements in to DIV element or Custom html tag -

i have used jeykll tool generate mark down content html . i want group below mark down elements in div element or other custom html tag. marked down #multiple axis {:.title} different types of data can visualized in single chart of {: .description} can used when need compare trends of different kinds of data. {: .description} html output <h1 id="multiple-axis" class="title">multiple axis</h1> <p class="description">different typ`enter code here`es of data can visualized in single chart of</p> <p class="description">it can used when need compare trends of different kinds of data.</p> how group above markdown div element or custom tag this <div class=""> <h1 id="multiple-axis" class="title">multiple axis</h1> <p class="description">different types of data can visualized in single char...

android - Async HTTP Request and Arduino -

i developing android application communicate arduino uno though wifi. arduino programmed turn on digital port number 12 when access address 192.168.11.110. when open browner , access address red led (connected port 12) turns on, when access again turns off, works perfectly. problem in android app make http request, led turns on , seems connection "stucked", can't turn off led , can't access through browser unless restart arduino or end android activity. the piece of code use make http request in android app this: public class arduinorequest extends asynctask<string, string, string> { @override protected string doinbackground(string... uri) { httpclient httpclient = new defaulthttpclient(); httpresponse response; string responsestring = null; try { response = httpclient.execute(new httpget(uri[0])); statusline statusline = response.getstatusline(); if(statusline.getstatuscode() == httpstatus.sc_ok){ byt...

performance - Conditional Branching Efficiency -

we part of discussion on how make codes more efficient , on topic of branching on if-else , came up. consider following piece of code: if (a==1) { //... tasks } else if (a==2) { //... tasks } ... } else if (a==9) { //... tasks } the discussion proved upper code lesser efficient 1 below because of number of comparisons must made towards lower half of code. consider alternative: if (a<=4) { if (a==1) { //... tasks } else if (a==2) { //... tasks } ... } else { if (a==5) { //... tasks } else if (a==6) { //... tasks } ... } in above case, checking a=5,6,7, or 8 takes lesser number of comparisons , more efficient. i've never come across code use logic. codes use switch statement or normal if condition mentioned in former snippet. latter code more efficient or take same amount of time? edit : above example. general idea distinguish disjoint sets of conditions pool of conditions , app...

linux - Is there a proper defined way to separate command arguments in C? -

for example, consider call: >routine -h -s name -t "name also" -u 'name well' would return 8 arguments or more? there defined standard how parsed? located? note: not interested in code this, rules or standards apply. not consider reading source code somewhere documentation of standard, assume must reside somewhere. the shell in use responsible parsing command line , invoking exec*() appropriately. see documentation specific shell in question learn rules, , see source code see how parses command line.

spring - How to increase the springMVC json response time -

in spring controller has long running process , returns output json, after time controller returns empty json while still processing in server. how handle in spring while fetching records database or getting records spring web services json or xml format connectiontimeout ( 500 i/o error ) or readtimeout error occurs. increase service elapsed time / connection timeout , read timeout in spring mvc using httpcomponentsmessagesender require jar spring-ws-2.1.3.release-all.jar add in web-inf/lib or add below maven dependency in pom.xml <!-- https://mvnrepository.com/artifact/org.springframework.ws/spring-ws --> <dependency> <groupid>org.springframework.ws</groupid> <artifactid>spring-ws</artifactid> <version>2.1.3.release</version> </dependency> add below code in mvc-dispatcher-servlet.xml <bean class="org.springframework.ws.transport.http.httpcomponentsmessagesender"> <...

yql - Java API to get quarterly revenue data from yahoo finace -

can please guide me data in csv format yahoo finance eg: need quaterly data 5 year(s) link: http://finance.yahoo.com/q/is?s=csco . thanks, you can use past (your date range) data. http://finance.yahoo.com/q/hp?s=x(where x stock name or code)

html - Save form data to XML using PHP with overwrite feature -

i'm trying make form data save in exertnal xml file. xml file exists , populated data. i need save form data xml file needs add new record everytime except if section in xml file same new form submission. if happens, needs modify record in xml file had same data. so if someones names mario bros , fills form first time, create new record in xml file. if same mario bros re-fill form same name, different "location" in form, overwrite existing mario bros in xml file. here's html code : <form> <table width="50%" align="center" cellpadding="2" cellspacing="0"> <tr> <td> first name:</td><td> <input type="text" name="firstname"></td> <td> last name:</td><td> <input type="text" name="lastname"></td> </tr> <tr> <td> location:</td><td> <input type="text...

unity3d - IllegalStateException when reading from ShortBuffer in Unity Android -

i'm working on game in unity, need raw audio data media buffer. following code being used jar plugin in unity. it's working on android 4.x without problems. when try run on android 5.0.1 or 5.1, following exception, when try open aac or m4a files. suggestions? this function, read audio buffer: public short[] readnextsamples() { if (sawoutputeos) { return new short[0]; } int res; while (true) { res = codec.dequeueoutputbuffer(info, ktimeoutus); if (res >= 0) { if (info.size > 0) { break; } else { codec.releaseoutputbuffer(res, false); if ((info.flags & mediacodec.buffer_flag_end_of_stream)!= 0) { sawoutputeos = true; return new short[0]; } } } } int outputbufindex = res; ...

node.js - Shopify Multipass in Dev Shop -

i'm attempting test out multipass in dev shop, managed multipass logic implemented in node.js now i'm getting error: "you not authorized use multipass login" i have multipass enabled in settings, there i'm missing? generally error means sending "remote_ip" parameter ip address of browser making request doesn't match 1 in parameter.

linux - Add the phpmyadmin config to the file? -

i try install phpmyadmin vps , stuck @ somewhere. the instruction says : after installation has completed, add phpmyadmin apache configuration. sudo nano /etc/apache2/apache2.conf add phpmyadmin config file. include /etc/phpmyadmin/apache.conf after pasted in sudo nano /etc/apache2/apache2.conf ci should do?

python - Pandas date ranges and averaging the counts -

i have below pandas dataframe stdate enddate count 2004-01-04 2004-01-10 68 2004-01-11 2004-01-17 100 2004-01-18 2004-01-24 83 2004-01-25 2004-01-31 56 2004-02-01 2004-02-07 56 2004-02-08 2004-02-14 68 2004-02-15 2004-02-21 81 2004-02-22 2004-02-28 68 2004-02-29 2004-03-06 76 i want take average of count based on month: that wanted like: date count 2004-01 (306/25-4) 2004-02 (349/28-01) for example second month enddate 3, (i need in aggregarting counts using pandas) it's not complicated, there bit of work, , think should ditch pandas of calculation, , build dataframe right @ end. suppose have 2 datetime objects, b , e . difference between them in days is (e - b).days this gives how count of row divided days. also, given month, can find last day of month using calendar module . so, following: counts_per_month = {} def process_row(b, e, count): ... # find how count splits between months...

progress 4gl OpenEdge parse key/value-pair string aka Query-String -

i cant find on how should parse string of key/value paris aka query-string one: fieldtype="string"&fieldformat="^[a-z0-9!#$%&'*+/=?^_`{|}~-]+$" field separators might contained in value above example not used web-request paramlist. i found this: running loop on comma delimited list of items progress 4gl but entry() not care if data in qoutation. = edit = so found not ideal solution hope nobody needs mimic do jj=1 num-entries(curr,"&"): define variable pos integer no-undo. assign k = entry( 1, entry(jj,curr,"&"), "=") v = entry( 2, entry(jj,curr,"&"), "=") pos = index( curr, k + "=" ). /* check if qouted value*/ if num-entries( substring( curr, pos, abs( index(curr, "&", pos) - pos) ) ,'"') > 1 ass...

matrix - How to solve n equation with Jacobi method by C++? -

this code should get number of equations (n) matrix a matrix b accuracy of answer (e)as input and find answer of n equations jacobi method. my code: #include <cstdlib> #include <iostream> #include <conio.h> #include <math.h> using namespace std; // dev software code using 'cin' instead 'scanf' int main() { int n,i,j,l=0; cout<<"enter number of equations = "; cin>>n; double a[n-1][n-1],b[n-1][1],x[n-1][1],t[n-1][1],e,k; cout<<"[a].[x]=[b]"<<endl; cout<<"enter matrix a:"<<endl; for(i=0;i<n;i++) for(j=0;j<n;j++) { cout<<"a["<<i<<","<<j<<"] = "; cin>>a[i][j]; } cout<<"enter matrix b:"<<endl; for(j=0;j<n;j++) { cout<<"b[0,"<<j<<"] = "; ...

How to remove image from amzon in rails -

i used paperclip module amazon s3 server storing images. i can uploaded image below line. album_photo.avatar.url(:original) but how can delete image s3? don't know how. i call simple destroy method below: def destroy @album.destroy respond_to |format| format.js end end but delete image db not s3. i referred paperclip - delete file amazon s3? link don't understand. so missing? try ,it should automatically delete it. <%= link_to "delete photo", photo_path, method: :delete, data: { confirm: "are sure?" }%>

c# - Change value of a table cell with WatIn -

using watin, can access url , change value of html table cell defined way : <table class=table1> <tbody> <tr class=dis> <td> rowspan="1" colspan="1" famille <input name="familysearch" onkeyup="tomaj(document.forms[0],'familysearch');changeformeltfocus(3, 'eng.faclab');" onfocus=onkeyback() maxlength=3 size=3 value="aaa"></input> <a onclick="popupfamily('rfos');" tabindex=-1 href="#"><img border=0 hspace=4 alt=" " src="/ppm/images/picto_loupe.gif" align=absmiddle></a> </td> </tr> </tbody> i tried using : browser.table(find.byclass("table1")).tablerows[0].tablecells[0].setattributevalue("aaa", "x82"); but i'm getting error saying can't access cell. idea ? thanks can try focusing , setting value. br...

scala - how to apply implicit conversion for implicit parameter? -

i want implicitly convert connection jdbc connection implicit connection parameter in sql method parameter. have code, throw compilation error. class jdbcconnection class connection(val connection: jdbcconnection) object connection { implicit def connection2jdbcconnection(connection: connection) = connection.connection } object db { def withtransaction[a](block: (connection => a)) = block(new connection(new jdbcconnection)) } object main { def sql(query: string)(implicit connection: jdbcconnection) = println("sql:" + query) def main(args: array[string]) = { db.withtransaction { implicit connection => sql("hello world") } } } error:(20, 10) not find implicit value parameter connection: jdbcconnection sql("hello world") ^ error:(20, 10) not enough arguments method sql: (implicit connection: jdbcconnection)unit. unspecified value parameter connection. sql("hello world") how can fix th...

c++ - FreeType OpenGL dynamic Text = abysmal performance -

i'm searching bottlenecks in code , turns out gui 1 of them. well, not gui rather dynamic text drawn there. initialization if (ft_init_freetype(&m_freetype)) throw helpers::exceptionwithmsg("could not init freetype lib"); if (ft_new_face(m_freetype, "res\\fonts\\freesans.ttf", 0, &m_fontface)) throw helpers::exceptionwithmsg("could not open font"); m_shaderid = ... // loads corresponding shader m_textcolorlocation = glgetuniformlocation(m_shaderid, "color"); m_coordinateslocation = glgetattriblocation(m_shaderid, "coord"); glgenbuffers(1, &m_vbo); ft_set_pixel_sizes(m_fontface, 0, m_fontsize); glyph = m_fontface->glyph; glgentextures(1, &m_texture); glactivetexture(gl_texture0); glbindtexture(gl_texture_2d, m_texture); // require 1 byte alignment when uploading texture data ...

python - Write double (triple) sum as inner product? -

since np.dot accelerated openblas , openmpi wondering if there possibility write double sum for in range(n): j in range(n): b[k,l] += a[i,j,k,l] * x[i,j] as inner product. right @ moment using b = np.einsum("ijkl,ij->kl",a,x) but unfortunately quite slow , uses 1 processor. ideas? edit: benchmarked answers given until simple example, seems in same order of magnitude: a = np.random.random([200,200,100,100]) x = np.random.random([200,200]) def b1(): return es("ijkl,ij->kl",a,x) def b2(): return np.tensordot(a, x, [[0,1], [0, 1]]) def b3(): shp = a.shape return np.dot(x.ravel(),a.reshape(shp[0]*shp[1],1)).reshape(shp[2],shp[3]) %timeit b1() %timeit b2() %timeit b3() 1 loops, best of 3: 300 ms per loop 10 loops, best of 3: 149 ms per loop 10 loops, best of 3: 150 ms per loop concluding these results choose np.einsum, since syntax still readable , improvement other 2 factor 2x. guess next step externalize code c o...

android - How to add glow effect on custom marker -

Image
my app has custom images , set marker icons based on different conditions. i'm using marker's seticon() method that. my question is, how can add glow effect on marker when selected. have selected/unselected logic in place, want create glow effect around shape of image used icon of marker. sample (the glow in question needn't in rounded shape): thank help! did try use blurmaskfilter outer setting? maybe playing paint , color can help bitmap alpha = origin.extractalpha(); blurmaskfilter blurmaskfilter = new blurmaskfilter(5, blurmaskfilter.blur.outer); paint paint = new paint(); paint.setmaskfilter(blurmaskfilter); paint.setcolor(0xffffffff); canvas canvas = new canvas(origin); canvas.drawbitmap(alpha, 0, 0, paint);

c# - Performing Linq operation on multiple possible combination of nullable values -

the title , method explains every thing. need perform search on bases of multiple options. don't want write possible conditions. suggestions? public list<ticket> gettickets(status? status,priority? priority,ticketlevel? ticketlevel, datetime? createdon,datetime? modifiedon,bool? removed) { if(status!=null && priority !=null && ticketlevel!=null && createdon==null && modifiedon==null && removed ==null) { using (crmcontext context=new crmcontext()) { return context.tickets.where( t => t.status == status && t.priority == priority && t.ticketlevel == ticketlevel).tolist(); } } throw new notimplementedexception(); } thank you! you use solution dave bish, or use ternary operator here. return context.tickets.where(t => (status != null ? t.status == status : true) &...

database design - ERWin Data Modeler forward engineer to multiple files -

Image
is possible forward engineer data model multiple files? example, data model has 10 table, 1 file per object; 10 files instead of one. i think on version 9. possible? yes possible,you can forward engineering of each table seperately. select table , click on forward engineer, generate script 1 table , can save script. or click on forward engineer, select filter on bottom left, choose table table pool. refer image below.

java - Eclipse word-document reader/text extractor -

i need create script read data word documents , process using java. when reading right out of file, text get's messed up, understandable. my question if there exists plugin eclipse extract text file? you can use apache poi libraries using xwpf xwpfdocument wd = new xwpfdocument(inputstream); xwpfwordextractor wde = new xwpfwordextractor(wd); general instruction read file

hibernate - Multi page form data validation in Play Framework? -

i beginner in java play framework. building app take form data spread in multiple pages 4 5 pages. data mapped same model. how can data uploaded user per page, validate against model's constraints, , @ end save whole data in model. for ex:- if page 1 has name field required, , page 2 has hobbies field required. how can validate data filled in particular page, navigate till last page, , save data in model, in last page. model have 60-70 fields. i using hibernate orm. thanks ! you prefill next form values of last form, save them in database, go next form, load entered values values , pre-fill next form , on. this, use method in controller: public static result filloutform1(){ hobby form1 = new hobby("sitting still", "diabetes"); form<hobby > prefilledform = newhobbyform.fill(form1); return ok(views.html.yourviewclass.render(prefilledform); } with "send" values first view class form. in there, user answers more fields , h...

css - Printed Barcode with Barcode39 Library Not Getting Scanned -

Image
i using barcode39 library in codeigniter generate barcodes. below helper function using generate barcode. function generatebarcode12($qty,$orderid,$orderitemid,$servicecatid){ $ci =& get_instance(); $ci->load->library('barcode39'); $ci->load->helper('upload_function'); $configarr = array( 'thickness' => 30, 'resolution' => 1, 'fontsize' => 2, 'a1' => 'a', 'a2' => '', 'code' => 'code39' ); $ci->load->library('barcode/barcodeclass',$configarr); $uploaddirconfig = uploaddirctoryconfig('barcode',$orderid); makedirectory($uploaddirconfig['main_dir_full_path']); makedirectory($uploaddirconfig['sub_dir_barcode']); makedirectory($uploaddirconfig['sub_child_dir_full_path']); $uploadpath = $uploaddircon...