Posts

Showing posts from August, 2010

Extracting .NET Resources to a File -

Extracting .NET Resources to a File - i need extract resources .net application location on hard drive. how can this? eg. have exe file in c# resources , want re-create resource file harddrive programaticaly. open resource stream , re-create it's content filestream. http://support.microsoft.com/kb/319292 might want .net resources

postgresql - What kind of index should I create to make "WHERE col1 LIKE '0000%' AND col2 = 'somevalue'" faster? -

postgresql - What kind of index should I create to make "WHERE col1 LIKE '0000%' AND col2 = 'somevalue'" faster? - i tried next queries in order search within quad tree using postgresql's like operator. in column col3 , there words '0133002112300300320' inserted, describes quad tree's path. create table table1 (col1 character(9) not null, col2 integer not null, col3 character varying(64), col4 integer not null, col5 double precision not null, primary key(col1,col2,col3)); -- performs sequential search select col1,col2,col3,col4,col5 table1 col1='somevalue' , col2=0 , col3 '01330021123003003%'; the problem primary key index set doesn't work where col1='somevalue' , col2=0 , col3 '01330021123003003%' . seems can't utilize like operator and operator @ same time if want utilize created index. are there special indices can create create select faster? it seems can't u...

vba - OpenArgs not passing variable to report -

vba - OpenArgs not passing variable to report - i pretty new vba , i'm trying create button on invoice creation form print invoice. on click event of button should open study , assign invoice id on form openargs property. private sub cmdprint_click() dim invoicenum integer if me.dirty 'save edits. me.dirty = false end if if me.newrecord 'check there record print msgbox "select record print" else invoicenum = me.[invoice number] docmd.openreport "invoice", acviewpreview, , , , invoicenum end if end sub then when study opens runs code: dim invoicenum integer invoicenum = me.openargs when click button on form however, come in parameter box appears. whats unusual the text in box value of invoice number want assign openargs property. cant work out how create value of openargs invoice number form. i'm not sure have done wrong , can't seem find reply anywhere. help appreciated. dim invoicenum integer ...

mkdir different behavior in Makefile and Terminal -

mkdir different behavior in Makefile and Terminal - i facing problem mkdir command in linux ubuntu 14. want create multiple directories @ same level, in makefile have done this. mkdir -v /opt/dir/{dir1,dir2,dir3} and output mkdir: created directory '/opt/dir/{dir1,dir2,dir3}' but when ran command direct on terminal, got expected result. 'mkdir: created directory /opt/dir/dir1' 'mkdir: created directory /opt/dir/dir2' 'mkdir: created directory /opt/dir/dir3' i unable find problem. any suggestion helpful. in advance. it looks me problem not mkdir works differently, shell you're using in terminal differs used create run commands. default create (gnu or other) uses /bin/sh. try add together shell=/bin/bash makefile. makefile mkdir

PHP. Strange numbers in the end of JSON -

PHP. Strange numbers in the end of JSON - i reading , saving weather json info forecast.io api. because using free api has 1000 requests limit per day. requesting api every 10 minutes. saving update time timestamp , using timestamp check 10 minutes elapsed or not. when reading json file , echoing it, unusual number '18706' or '22659' coming out. not have thought coming from. how solve problem? result in browser: ....madis-stations":["uttt"],"units":"si"}}22659 php: <?php $t = time(); $last_updated_timestamp = file_get_contents("last_updated_timestamp.txt"); $delta = ($t - $last_updated_timestamp) / 60; if ($delta > 10) { $json = file_get_contents('https://api.forecast.io/forecast/my_api_key/41.2667,69.2167?units=si&lang=ru'); $obj = json_decode($json); echo $obj->access_token; $fp = fopen('tw.json', 'w'); fwri...

android - Automation testing with ARC? -

android - Automation testing with ARC? - i'm using arc manually test app, hoping move towards automation of testing process. is possible utilize arc automate tests, similar selenium webdriver ff/chrome? i know it's still in development process incredibly helpful. yes. arc supports android adb "shell instrument" command, per android documentation see getting started document starting adb. if create .apk tests separate .apk beingness tested, need bundle both .apk files in .crx package. should straightforward incorporate doing , launching tests build/test environment. android google-chrome-arc

Grails 3.0 error, nullpointer -

Grails 3.0 error, nullpointer - i trying run grails 3.0.1 in commandline via "grails" failed next stacktrace: | error error occurred running grails cli: null java.lang.nullpointerexception @ org.codehaus.groovy.runtime.defaultgroovymethods.collect(defaultgroovymethods.java:3137) @ org.grails.cli.profile.git.gitprofilerepository.getallprofiles(gitprofilerepository.groovy:72) @ org.grails.cli.profile.commands.listprofilescommand.handle(listprofilescommand.groovy:43) @ org.grails.cli.grailscli.execute(grailscli.groovy:173) @ org.grails.cli.grailscli.getbaseusage(grailscli.groovy:118) @ org.grails.cli.grailscli.execute(grailscli.groovy:162) @ org.grails.cli.grailscli.main(grailscli.groovy:99) | error error occurred running grails cli: null i'm using version of java java version "1.8.0_40" java(tm) se runtime environment (build 1.8.0_40-b26) java hotspot(tm) 64-bit server vm (build 25.40-b25, mixed mode) i have tried...

php - Price calculator by each hour -

php - Price calculator by each hour - i'm making pricing calculator adds difference between 2 dates. standard cost $500.00 amount of hours (example 3 hours). if difference on minimum hour, add together $100.00 standard price. i used php generate cost in email when total time posted. // html <label>start date &amp; time</label> <input type="datetime" id="time2" name="start" data-bind="value: start, valueupdate:'keyup'" required="required" placeholder="dd/mm/yyyy hh:mm:ss or pm"> <label class="label">end date &amp; time</label> <input type="datetime" id="time1" name="end" data-bind="value: end, valueupdate:'keyup'" placeholder="dd/mm/yyyy hh:mm:ss or pm" required="required"> <label class="label">time total:</label> <input type="text" name="...

ruby on rails - Heroku Restore Not working...! -

ruby on rails - Heroku Restore Not working...! - i trying restore local db.dump file heroku app..!! using:- heroku pg:backups restore 'https://s3.amazonaws.com/somebucket/db.dump' database mydb but getting error :- an error has occured , backup did not finish please run 'heroku logs --ps pg-backups' details. when run doesnt show logs. please help new ror make sure source of dump right & have made application downwards while restoring db. seek accessing logs after sometime. in case logs empty , error still persists, need contact heroku support. there not much can this. ruby-on-rails heroku

c - Is this treatment of int64_t a GCC AND Clang bug? -

c - Is this treatment of int64_t a GCC AND Clang bug? - now, of tempted shout undefined behaviour, there's problem. type int64_t not defined c standard posix. posix defines type as: a signed integer type width n, no padding bits, , two's-complement representation. it not leave implementation define , not allow treated unbounded integer. linux$ cat x.c #include <stdio.h> #include <stdlib.h> #include <inttypes.h> int stupid (int64_t a) { homecoming (a+1) > a; } int main(void) { int v; printf("%d\n", v = stupid(int64_max)); exit(v); } linux$ gcc -ox x.c -wall && ./x 0 linux$ gcc -ox x.c -wall -o2 && ./x # error. 1 linux$ gcc --version gcc (debian 4.9.2-10) 4.9.2 copyright (c) 2014 free software foundation, inc. free software; see source copying conditions. there no warranty; not merchantability or fitness particular purpose. linux$ uname -a linux localhost 3.14.13-0-amd64 #1 smp sat jul 26 20:03:23...

VSTO: Issue with adding text to a list item in a list in MS Word doc using C# -

VSTO: Issue with adding text to a list item in a list in MS Word doc using C# - original list in ms word 2010 doc: a b c d e the code add together text "test" end of item 2 (with value b) in list: word.application oapp = new word.application(); word.document odoc = oapp.documents.open(filename: @"c:\folder1\test1.docx"); string st = odoc.lists[1].listparagraphs[1].range.text; odoc.lists[1].listparagraphs[2].range.text = st + "test"; ((word._document)odoc).close(savechanges: word.wdsaveoptions.wdsavechanges); ((word._application)oapp).quit(); resulting list: a a testc d e what wanted: a btest c d e notice in resulting list code doing 2 things wrong: 1. replacing sec item value b , 2. adding text "test" @ origin of item value c. c# ms-word ms-office vsto office-interop

Splitting a column in an R dataframe -

Splitting a column in an R dataframe - i have column of info in r info frame has values such as: blue-#105 green-#8845 yellow-#5454 blue-#999 i want remove lastly number part (starting @ -#) blue-#999 , blue-#105 consider same thing when plotting. how accomplish this? use regular expressions: > df <- data.frame(col=c("blue-#105", "green-#8845", "blue-#999")) > df col 1 blue-#105 2 green-#8845 3 blue-#999 > df$col <- gsub("-\\#.*", "", df$col) > df col 1 bluish 2 greenish 3 bluish > here strings starting -# (where comment char # needs escaped) , followed whatever --- .* in regular look lingo: char (the dot) repeated many times fits (the star) --- replaced empty string, or in other words, removed. r

Javascript nested function attribute inheritance -

Javascript nested function attribute inheritance - im trying utilize attribute of function in nested function don't know how, without passing parent function. example: function foo() { this.baz = 'baz' this.bar = new bar() } function bar() { this.bla = 'bla' } bar.prototype.func = function() { console.log(...) // should homecoming 'baz' (attr baz of foo()) } so far tryed this: function foo() { this.baz = 'baz' this.bar = new bar(this) } function bar(foo) { this.bla = 'bla' this.foo = foo } bar.prototype.func = function() { console.log(this.foo.baz) } is there pattern accomplish this? since workaround mess edit: since of wanted more reallife exapmle: function game() { this.world = { x: 200, y: 300 } this.players = { one: new player() two: new player() } } function player() { this.size = {x:1,y:2} this.position = { ...

ubuntu - Configure Nginx on digitalocean -

ubuntu - Configure Nginx on digitalocean - i got new digitalocean server yesterday, , can't work. i'm using lemp stack on ubuntu 14.04. my website not yet on server, i'm pointing standard nginx html directory /usr/share/nginx/html; i've reinstalled nginx once. when reinstall, works, add together much space default config file in /etc/nginx/sites-available/ stops working chrome gives me err_connection_refused i did request postman, , response code 0. can ping both server's ip address , domain name (vandevliet.me) , gets response back. this nginx default file (without commented out server blocks) server { hear 80 default_server; hear [::]:80 default_server ipv6only=on; root /usr/share/nginx/html; index index.html index.htm; # create site accessible http://localhost/ server_name localhost; location / { try_files $uri $uri/ =404; } } and /etc/hosts file 1...

ruby - session + devise authentication -

ruby - session + devise authentication - i want authentication ,many people login particular username , password @ same time , not , user logs in username = sammy , password = sammy123, user b cannot login same username = sammy and in 1 session password = sammy123 while still logged application...,i using ruby 1.8.7 , devise gem authentication, rails 2 1.add column(flag) in table mdl_user store 'false' value when user create new business relationship . 2.make function take 3 value table name,flag field , username(which user enter) .this function homecoming value of flag field (true or false) .this function phone call if user exist in database. 2.1 if 'false' returned allow login user , insert value flag field 'true'. 2.2 if 'true'retuned not allow login , print message below username , password field "this user logged".do not insert value in database. 2.3 when sign out user insert flag field value 'flase'. 3.u...

Connect single queue to multiple qmgrs C++ -

Connect single queue to multiple qmgrs C++ - i want connect single queue multiple queue managers (atleast 2 qmgrs). lets have qmgra , qmgrb queue managers , connected queuename . set message "hello" queuename connected qmgra message "world" on qmgrb. suppose queuename contains "hello" , "world". the question how can messages simultaneously? can give me illustration code fragment/snippet me atleast have overview of how can start coding design. note: *i asking because illustration qmgra got disconnected/down unknown reason, atleast qmgrb still active , messages on queuename though qmgra disconnected. by way, i'm using websphere mq v7 c++. thanks in advance! :) the question appears asking how ibm mq not do. qmgrs not "connect" queues, host them. applications not "connect" queues except in abstract jms sense. connect qmgrs , open queues. however, requirement described of keeping mq hi...

java - JBoss + Netty + Connection reset by peer = Thread leak -

java - JBoss + Netty + Connection reset by peer = Thread leak - i have application uses netty handle communication external devices. application runs on jboss eap 6.1. seems when device tears downwards connection running thread count increases, not decrease after time_wait connection removed. looks this: 1 hear threads: 207 1 hear 1 time_wait threads: 211 1 hear 1 time_wait threads: 211 1 hear 1 time_wait threads: 210 1 hear 1 time_wait threads: 209 1 hear 1 time_wait threads: 209 1 hear 1 time_wait threads: 209 1 hear threads: 209 1 hear threads: 209 as can see thread count before connection 207, when connection established , broken device thread count 211 - downwards 209, never goes downwards 207. every next occurence of above scenario causes thread count increment outofmemory thrown. i've added logging run() method of each custom thread class implemented can match "thread started" "th...

java - Do we have to add any configuration in openfire or modify hazelcast plugin to avoid this exception "HazelcastSerializationException" -

java - Do we have to add any configuration in openfire or modify hazelcast plugin to avoid this exception "HazelcastSerializationException" - stack trace : severe: [172.31.37.7]:5701 [openfire] java.lang.classnotfoundexception: com.jivesoftware.util.cache.clusteredcachefactory$callabletask com.hazelcast.nio.serialization.hazelcastserializationexception: java.lang.classnotfoundexception: com.jivesoftware.util.cache.clusteredcachefactory$callabletask @ com.hazelcast.nio.serialization.defaultserializers$objectserializer.read(defaultserializers.java:190) @ com.hazelcast.nio.serialization.streamserializeradapter.read(streamserializeradapter.java:40) @ com.hazelcast.nio.serialization.serializationserviceimpl.readobject(serializationserviceimpl.java:276) @ com.hazelcast.nio.serialization.bytearrayobjectdatainput.readobject(bytearrayobjectdatainput.java:431) @ com.hazelcast.executor.basecallabletaskoperation.readinternal(basecallabletaskoperation.java:91) ...

Check Twilio balance from API -

Check Twilio balance from API - does know how programmatically check business relationship balances in twilio (via api)? not implemented? it's not possible check business relationship balances via twilio api. please see rest api documentation what's possible: https://www.twilio.com/docs/api/rest api twilio balance

c# - Unity2D ParticleSystem: Change the particle width and height with different values -

c# - Unity2D ParticleSystem: Change the particle width and height with different values - how can create each particles stretch horizontally time goes on? seems unity 2d particlesystem have 1 float value size instead of separate float width , height. i don't see options in inspector animate width , height of particlesystem separately. here progress far. copied initial code unity doc site here , edited bit can alter size of each particle. using unityengine; using system.collections; public class sampleparticle : monobehaviour { particlesystem m_system; particlesystem.particle[] m_particles; private void lateupdate() { initializeifneeded(); int numparticlesalive = m_system.getparticles(m_particles); // alter particles live (int = 0; < numparticlesalive; i++) { //============================================================ // here, can alter 1 value size of each particle ...

javascript - How to make div expand width 100% responsively? -

javascript - How to make div expand width 100% responsively? - i have 2 div's (left, right). content in left div empty pages/requests; , hide left div such requests. when left div hidden/ removed, want right div fill entire page. to accomplish i'm using table-cell . works when remove left div right div width changes total page (100%) content width. html <div id="main"> <div id="left">testjjj</div> <div id="right">test<br /> test<br /> test<br /> test<br /> test<br /> test<br /> test test made in test made in test madein<br /></div> </div> css #main{width:100%;border:1px solid red; position:relative } #left { display: table-cell; width:100px; vertical-align:middle; text-align:center; background:red } #right { display: table-cell; width:100%; vertical-align:middle; background:ligh...

c - How I generate RAW BIN with declared segment offset using WatCom -

c - How I generate RAW BIN with declared segment offset using WatCom - i wrote boot loader in nasm load 64kb programme info disk memory starts address 0060:0000 [seg:off]. had tested part of project writing code in assembly (nasm) , set disk. works fine! the total project little bit complex totally writing in assembly. decide utilize c inline assembly further. download environment named open-watcom-c-win32-1.9. have simple c code testing watcom compiler , linker directives create raw bin file. bin file generated not runs after boot loader load memory. seek lot of wlink directives set segment , offset values not works. void main() { __asm { mov ah, 0x0e mov al, '!' int 0x10 } } i think problem compiler , linker uses wrong segment , offset addresses while code generating. because wlink drop next error in case. warning! w1023 no starting address found, using 0000:0000 i not know how can set correctly segment offset a...

What does the classifier report tell us in skikit-learn? -

What does the classifier report tell us in skikit-learn? - i'm using skikit-learn text classification. when used classification_report() function returned next table: precision recall f1-score back upwards neg 0.86 0.69 0.77 351 pos 0.82 0.92 0.87 517 avg / total 0.83 0.83 0.83 868 what meaning of precision, recall , f1-score? conclusions can made above values? also, these values reflect classifier? recall reflects how many examples of given class labeled beingness of class. precision reflects how many examples labeled classifier beingness of class examples class. suppose have 2 classes neg , pos . if label all of examples beingness of class neg recall neg great, @ 1.00 or 100%, because whenever illustration of class neg labeled neg . @ same time recall pos horrible, because not single illustration of class pos labeled pos . additionally precis...

windows - How do you enable powershell to interpret ansi color codes when using get-content to echo to the screen? -

windows - How do you enable powershell to interpret ansi color codes when using get-content to echo to the screen? - i have log file contains ansi color codes around various text. i'm echoing console using powershell language command: get-content logfile.log -wait so can see latest log changes. however, ansi color codes show text characters like: esc[90mesc[39m how them intepreted color codes in powershell window? not beingness familiar powershell language yet, there powershell command or encoding alternative handle this? i've read various powershell docs haven't found in them re these ansi codes. you can translate ansi escape codes colors splitting text @ esc , translating colors write-host .... -forground <color> instructions. function open-colored([string] $filename) { write-colored(cat -raw $filename) } function write-colored([string] $text) { # split text @ esc-char $split = $text.split([char] 27) foreach ($line in...

aggregation framework - How do i express this sql statement in mongodb -

aggregation framework - How do i express this sql statement in mongodb - i tried poking around see basic examples. i looking express following: select average((a+b)/c) table i have: db.props.aggregate( [ { $group: { _id: "$id", a_: { $avg: "$a" },b_:{$avg:"$b"} } }, {$match:{a_:{$gt:0},b_:{$gt:0}}} ] ) but missing pieces. tried applying operations in $avg statement doesnt work. something this? { $group: { _id: "$_id", average: { $avg: { $divide: [ {$add: ["$a","$b"]}, "$c" ] } } } } mongodb aggregation-framework

asp.net - can we add image through img tag in C#.net -

asp.net - can we add image through img tag in C#.net - i want add together image through img tag in c#.net tried next logic it's not work string img+="img src="abc.jpg" if know plz reply me in markup: <asp:image id="myimage" runat="server" /> in code-behind: myimage.imageurl = "abc.jpg"; c# asp.net image

class - Is there a best practice for writing maps literal style in Java? -

class - Is there a best practice for writing maps literal style in Java? - in short, if want write map of e.g. constants in java, in e.g. python , javascript write literal, t<string,string> constants = { "constant_name_0": constant_value_0 , "constant_name_1": constant_value_1 , "constant_name_2": constant_value_2 , //... } ; is there class or preset object can utilize writing info construction that? constants? i'd utilize enum. public enum constants { name_1("value1"), name_2("value2"), name_3("value3"); private string value; constants(string value) { this.value = value; } public string value() { homecoming value; } } value e.g. name_2 can obtained follows: string name2value = constants.name_2.value(); only give enum bit more sensible name, e.g. settings , defaults , etc, whatever name/value pairs actually repr...

How does MATLAB's normpdf function work? -

How does MATLAB's normpdf function work? - when trying plot normal pdf mean=0 , standard deviation=20 using matlab command normpdf() weird results, see picture. the code used plot figure follows: plot(normpdf((-100:0.1:100),0,20)) what right way of using function? when phone call plot 1 argument, plots numbers on y axis, using index numbers of values x axis. if wanted x axis scaled properly, had provide them in first place. thus... x = -100:0.1:100; plot(x,normpdf(x,0,20),'-') matlab

Unit testing a function that returns a pointer (C++) -

Unit testing a function that returns a pointer (C++) - this question has reply here: pointer local variable 8 answers i have next function: unsigned* b_row_to_array(b_row r) { unsigned a[] = {(r >> 8) & 3, (r >> 6) & 3, (r >> 4) & 3, (r >> 2) & 3, r & 3}; homecoming a; } that wrote next test function for: test_method(browtoarraytest) { unsigned expected[] = { 0, 0, 0, 0, 0 }; unsigned* computed = b_row_to_array(0); (int = 0; < 1; i++) { assert::areequal(expected[i], computed[i]); } } but test fails, saying "expected:<0>, actual:<42348989>", value actual different every test, must reading in wrong address. using pointers wrong or read out-of-bounds because test function not in same project? how can solve this? that...

android - Share Photo on Facebook using Facebook 4.0 without native app installed -

android - Share Photo on Facebook using Facebook 4.0 without native app installed - i'm using facebook 4.0 share photos through app i'm unable share photos phone. can share image net providing it's url doesn't work image phone. code i'm using sharing below. public void sharephoto(uri contenturi, string contenttitle, bitmap image, string contentdescription){ sharedialog facebookdialog = new sharedialog(getactivity()); sharelinkcontent.builder content = new sharelinkcontent.builder(); content.setcontenturl(contenturi); content.setcontenttitle(contenttitle); content.setimageurl(getimageuri(getactivity(), image)); content.setcontentdescription(contentdescription); sharelinkcontent sharecontent = content.build(); facebookdialog.show(sharecontent); } public uri getimageuri(context incontext, bitmap inimage) { bytearrayoutputstream bytes = new bytearrayoutputstream(); inimage.compress(bitmap.compressformat.jpeg, 100, by...

linux - How does PHP choose what email address it sends from? -

linux - How does PHP choose what email address it sends from? - i noticed odd while doing testing on someone's development server. using very simple mail service test... mail('iamnotsharingmy@email.com', 'test subject', 'test message'); ...on receipt, sender root@ , other times sender www-data@ . what causes change, seemingly, randomly? yes, know sender can set in headers, curious causes default behavior. server information ubuntu server 12.04 apache/2.2.22 php version 5.3.10-1ubuntu3.7 in response barmar's comment echo exec('whoami'); returns www-data user web server running under. so, cause scripts run root instead of web server user? php linux apache email webserver

android - Robguice proguard forces -

android - Robguice proguard forces - this bare minimum specified roboguice proguard support: https://gist.github.com/matthawley/1327908 i forced add together these prevent code crashing: -keep class com.appmanager.ui.fragments.* { *; } -keep class com.appmanager.ui.views.* { *; } which means of views , fragments not obfuscated. there way circumvent behaviour? i'm not big expert of progurad . according documentation can inquire proguard maintain annotated fields. i've checked official roboguice wiki proguard , saying requires field names, activity names, services names, specific method names, etc. i'm not sure how big project , how wide roboguice used. can seek dependency injection dagger uses much less reflection (version 2.0 free reflection @ all) android proguard roboguice

angularjs - How install Start Angular template correctly? -

angularjs - How install Start Angular template correctly? - i'm new in angular development, found this template , utilize it. i'm doing this: sudo apt-get install -y nodejs sudo apt-get install -y npm sudo npm install -g bower sudo npm install -g grunt-cli clone repository of project: git clone https://github.com/start-angular/sb-admin-angular.git cd sb-admin-agular npm install bower but when seek execute command npm start , gives me follow error: vagrant@themachine:~/sb-admin-angular$ npm start > sb-admin@0.0.0 start /home/vagrant/sb-admin-angular > grunt serve /usr/bin/env: node: no such file or directory npm err! weird error 127 npm warn failure might due utilize of legacy binary "node" npm warn farther explanations, please read /usr/share/doc/nodejs/readme.debian npm err! not ok code 0 vagrant@themachine:~/sb-admin-angular$ any thought how solve ? or causing ? you might missing dependencies. looks installed bower. seek ...

Cordova push notifications no relying on we view -

Cordova push notifications no relying on we view - i building app tabris.js , looking cordova plugin force notifications not rely on webview. yet find such thing. wondering if there plugin , tabris not utilize webview , hence popular plugins have found fail. regards pc you can utilize plugin @ http://plugins.cordova.io/#/package/com.phonegap.plugins.pushplugin receive force notifications. cordova cordova-plugins

Assign an Instance in a ForeingKey in Django -

Assign an Instance in a ForeingKey in Django - i got kind of error before , prepare it, don't know what's happening, how can prepare it? i'm getting: cannot assign "u'2'": "closedbets.bet_user_a" must "teams" instance. my models: class closedbets(models.model): match = models.foreignkey(match2x1) user_a = models.foreignkey(user,related_name="+") bet_user_a = models.foreignkey(teams,related_name="bet_user_a") user_b = models.foreignkey(user) bet_user_b = models.foreignkey(teams,related_name='bet') def __unicode__(self): match = "%s vs %s"%(self.match.team_a,self.match.team_b) homecoming match my views: z = bets.objects.filter(match_id=request.post['match']).exclude(user=self.request.user).filter(~q(bet_id=request.post['team']),value=request.post['valor']) bet = z.first() if b...

drupal 7 - Commerce License Role Module -

drupal 7 - Commerce License Role Module - i have utilize drupal 7.36. have install many modules.i have used drupal commerce module payment gateway.when ever install commerce license role module error display this. databaseschemaobjectexistsexception: table field_data_num_renewals exists. in databaseschema->createtable() (line 657 of c:\xampp\htdocs\aptech_video\includes\database\schema.inc). so how can solve error ? drupal-7 drupal-commerce

c++ - How to send and receive data up to SO_SNDTIMEO and SO_RCVTIMEO without corrupting connection? -

c++ - How to send and receive data up to SO_SNDTIMEO and SO_RCVTIMEO without corrupting connection? - i planning how develop man in middle network application tcp server transfer info between server , client. behave regular client server , server remote client without modifying data. optionally used observe , measure how long server or client not able receive info ready received in situation when connection inactive. i planning utilize blocking send , recv functions. before info transfer phone call setsockopt function set so_sndtimeo , so_rcvtimeo 10 - 20 miliseconds assuming forcefulness blocking send , recv functions homecoming in order allow active connection info routed. running thread per connection looks expensive. not utilize async sockets here because can not find guarantee finish in parts of sec when big info amount beingness sent or received. high info delays not good. utilize little buffers here calling function each received byte looks overki...

java - Creating an Akka actor system on an Android -

java - Creating an Akka actor system on an Android - i'm trying create akka actor scheme on android (kitkat) device (with intellij + gradle) using java. first, had add together multidexenabled flag (and multidex back upwards android library) include com.typesafe.akka:akka-actor_2.10:2.3.9 library (otherwise, i'd nail 65535 dex function limit). then, started getting next lint warning: message="invalid bundle reference in library; not included in android: java.lang.management . referenced scala.sys.process.package. ." category="correctness" priority="6" summary="package not included in android" explanation="this check scans through libraries looking calls apis not included in android. i suppressed warning, able build , started debugging code. however, plenty encountered java.lang.verifyerror: scala/none$ exception during creation of actorsystem. what doing wrong? should using older akka version (i ...

java - How to get same monitor when calling notifyAll()? -

java - How to get same monitor when calling notifyAll()? - main thread creating 2 thread t1 , t2 run() method of these thread creating 2 new thread c1 , c2.i want scenario such until c1&c2(of t1) live t2 not start executing. in code notify , wait causing runtime exception.since not in synchronised block, how this? public class childtcreat2newthread { public static void main(string[] args) throws interruptedexception { thread maint=thread.currentthread(); target ra=new target("a"); thread t1=new thread(ra); t1.start(); t1.join(); while(ra.getc1().isalive()==true||ra.getc2().isalive()==true){ synchronized (maint) { maint.wait(); }} new thread(new target("b")).start();}} class target implements runnable{ thread c1=new thread(new target1("1")); thread c2=new thread(new target1("2")); string msg; target(string msg){ this.msg=m...

Catch import warnings in Python -

Catch import warnings in Python - suppose have file a.py next contents: import warnings warnings.warn("a deprecated", deprecationwarning) i want grab warning when import , assert deprecationwarning . i'm doing following: import warnings warnings.catch_warnings(record=true) w: import and trying assert using assert_equal(w[0].category, deprecationwarning) shows w empty. isn't catching warning guess. there other way this? edit: forgot add together tried warnings.simplefilter("always") , no warning recorded. edit 2: have warning levels. [see comments] edit 3: tried different stacklevel s - 0, 1, 2, 3. no effect :| you need add together line warnings.simplefilter("always") to code, this: with warnings.catch_warnings(record=true) w: warnings.simplefilter("always") import so, working version of 'b.py' (as were) might this: import warnings import unittest class testwarnin...

scala - How to fix type inference error in this example? -

scala - How to fix type inference error in this example? - suppose writing: sealed trait status object error1 extends status case class ok(x: int) extends status def foo(opt: option[int]): status = opt.fold(error1)(x => ok(x)) when seek in repl error: scala> def foo(opt: option[int]): status = opt.fold(error1)(x => ok(x)) <console>:11: error: type mismatch; found : ok required: error1.type def foo(opt: option[int]): status = opt.fold(error1)(x => ok(x)) ^ i can work around not particularly elegant: // work around type error above val error1: status = error1 def ok(x: int): status = ok(x) def foo(opt: option[int]): status = opt.fold(error1)(x => ok(x)) how suggest solving type problem ? as see fold infers homecoming type zero/fallback value provided first arg. there error resolve specific type of value. you can annotate fold in next ways indicate want sta...

c# - "The anti-forgery cookie token and form field token do not match" on page with ViewModel and two forms -

c# - "The anti-forgery cookie token and form field token do not match" on page with ViewModel and two forms - in mvc4 app running on mono error: the anti-forgery cookie token , form field token not match on "login , register" page. page has loginorregisterviewmodel looks follows: public class loginorregisterviewmodel { public loginmodel login { get; set; } public registermodel register { get; set; } } which gets passed page on request. there 2 html.beginforms() on page, login -form , register -form. first calls login action on controller, sec register action. both actions have validateantiforgerytoken attribute. when form submitted respectively login or register obtained loginorregisterviewmodel . when page loaded , registered user tries login after tim (few hours?) "login , register" page shows, when login form submitted error above shows until root page refreshed. i have included machine key web.config , have add...

Display grayscale to color image when state change using GPUImage in android -

Display grayscale to color image when state change using GPUImage in android - my main intention alter image colored grayscale using gpuimage when state alter of imageview.. when scolling horizontallistview, changes images using statelistdrawable. now, what, want simple set first time when load listview grayscale colored image. , when state alter set in images on imageview colored time, , defined below. have not lot o thought gpuimage. so, please correct, where, doing wrong. public class customarrayadapter extends arrayadapter<customdata> { private layoutinflater minflater; public customarrayadapter(context context, customdata[] values) { super(context, r.layout.custom_data_view, values); minflater = (layoutinflater) getcontext().getsystemservice( context.layout_inflater_service); mcontext = context; } @override public view getview(int position, view convertview, viewgroup parent) { final hold...

Couchbase PHP Connect Hello World! on Mac -

Couchbase PHP Connect Hello World! on Mac - i installed couchbase server , php sdk through brew install libcouchbase on mac. server admin console running/working fine on http://127.0.0.1:8091/. added hello.php file below code in /library/webserver/documents/hello.php . <?php $cb = @new couchbase("http://127.0.0.1:8091/",'username','password'); if($cb->getresultcode() != couchbase_success){ throw exception('cannot connect couchbase!'); } else { echo "hello world!"; } when go http://127.0.0.1:8091/hello.php , error saying not found. . problem? when go http://127.0.0.1:8091/hello.php, below error not found.. problem? you going wrong port. port 8091 couchbase server console interface. looks trying deploy hello.php script using apache server shipped os x uses default http port (80). script located in wrong folder. believe /library/webserver/documents/ static content only. given problem have ran cre...

ruby on rails - "uninitialized constant XmlSimple::Zlib" in ROR xml parsing -

ruby on rails - "uninitialized constant XmlSimple::Zlib" in ROR xml parsing - hi using gem 'xml-simple' parse xml info in ruby on rails, getting error called "uninitialized constant xmlsimple::zlib". can body tell error is? perhaps cobravsmongoose solve problem :) ruby-on-rails

matlab - Double integration using MEX -

matlab - Double integration using MEX - i need write mex file evaluate double integral of arbitrary function, since in matlab numerical integration slow. far able defining hand possible functions utilize , parse string in mex file take 1 integrate. ugly. send mex file straight function, like myintmex(@(x,y)f,0,1,0,1) to integrate function f in interval [0,1]x[0,1] . so far alternative have found mexcallmatlab have read slower pure matlab. have found free code here works single integrals. so question is: how do it? how give mex file function handle? code exists? matlab integration anonymous-function mex

asp.net mvc - Data not loading on partial view, MVC -

asp.net mvc - Data not loading on partial view, MVC - i doing work on form user can come in client record....view scaffold create controller. on 'create' view, user can come in 'engineno' check details passes action "checkrecord",,it can seen view... <form> <input type="text" id="enginno" /> <input type="button" value="search" id="btnsearch" /> </form> @using (html.beginform("index","home",formmethod.get)) { @html.antiforgerytoken() <div id="info"> @{html.renderaction("checkrecord","sales");} </div> create fields } the create , "checkrecord" actions are,, public actionresult create() { viewbag.customerid = new selectlist(db.customersdms, "customerid", "name"); viewbag.smclientbranchid = new selectlist(db.smclientbranchesdms, "smclientid", "nam...

mysql - SQL query to extract some rows from one row of a table -

mysql - SQL query to extract some rows from one row of a table - i have table like: create table company ( id integer auto_increment primary key company_name varchar(50), category_1 varchar(50) not null, category_2 varchar(50) not null, category_3 varchar(50) not null) insert company values ('apple', 'mobile', 'pc', 'gadget'); how can create query returns: 1, 'apple', 'mobile' 2, 'apple', 'pc' 3, 'apple', 'gadget' you can utilize union : select id, company_name, category_1 company union select id + 1, company_name, category_2 company union select id + 2, company_name, category_3 company sqlfiddle mysql sql

eclipse - How to make Android App (.apk file size) size smaller? -

eclipse - How to make Android App (.apk file size) size smaller? - i have been working on eclipse ide , smallest apk file (hello world) takes 2-3mb of size. while application greenify, beingness advanced, < 2mb. i did find answers related complicated understand. look setting proguard eclipse. don't have experience running proguard in eclipse, on gradle builds if have minifyenabled , shrinkresources set true, cut down apk size. android eclipse

javascript - Instance Creation ( JS ) -

javascript - Instance Creation ( JS ) - i've been reading substack modules , notice style of creating new instace of object. if (!(this instanceof browserify)) homecoming new browserify(files, opts); https://github.com/substack/node-browserify/blob/master/index.js#l37 i know this in "this" particular case refers window obj, , browserify wont instance of (window). my question : thoughts way or style creating object ? / convenient way of instantiating object without having do. var brows = require('browserify') , var x = new brows() effectively prevents calling constructor without returning instance of object, or eliminates need utilize new keyword. next same thing: var brs = new browserify(); var brs = browserify(); brs instantiated browserify object either way. as why or necessary -- think matter of sentiment more else. javascript node.js browserify

ios - How to NSManagedObject Subclass added error -

ios - How to NSManagedObject Subclass added error - nsmanagedobject seems subclass creating image. however, newly formed .h in next code not added @interface album (coredatageneratedaccessors) - (void)addphotosobject:(photo *)value; - (void)removephotosobject:(photo *)value; - (void)addphotos:(nsset *)values; - (void)removephotos:(nsset *)values; @end ios objective-c

proxy - Charles - How to rewrite a HTTP response encoded in GZIP? -

proxy - Charles - How to rewrite a HTTP response encoded in GZIP? - i trying alter body of http response (for debugging purposes) using charles webproxy. however, response gziped , when modify in body (using tools-->rewrite options) 2 problems emerge: the content-length header not updated reflect new info i've added response. have manually update myself. even if update content-length manually, seems new gzip body invalid (ie, not gziped correctly). i can't remove content-encoding: gzip request because don't have command on code consumes response. code expecting gzip body , fails parse info if remove gzip encoding response removing content-encoding: gzip request. how can modify gziped response body using charles? http proxy rewrite gzip charles

How to return datatable in VB.net -

How to return datatable in VB.net - i new vb.net. i got task upgrade website vs 2008 vs 2012. appreciate if help here. have posted code, don't understand dbaccess in that, , because of that, getting many errors imports system.data imports authenciate imports scheme imports system.io imports system.text imports system.data.sqlclient public class functions enum enumtype eproject enonproject end enum enum enumtimeformat hh_mm_ss hh_mm end enum public function crosstabcustomerwise(byval fromdate string, byval todate string, byval deptid long, optional byval empcode string = "") object dim strsql new system.text.stringbuilder '= "select * t3_viewsummary logdate between " & "'" & fromdate & "' , '" & todate & "' " dim strquery new system.text.stringbuilder 'strquery.append(" select client t3_forcrosstable ") st...

jquery - Can't submit a form using DataTables -

jquery - Can't submit a form using DataTables - i have form , when remove datatables, it's working properly. when set <table id='example'> utilize datatables, not submit form. if set echo form_open before ` doesn't work properly, inserts teacher_id=13, not different row, i've chosen. that's view: class="snippet-code-html lang-html prettyprint-override"> <html> <head> <link href="//cdn.datatables.net/1.10.5/css/jquery.datatables.css" rel="stylesheet" type="text/css" /> <script src="http://code.jquery.com/jquery-2.0.3.min.js"></script> <script src="http://code.jquery.com/jquery-1.11.1.min.js"></script> <script src="http://code.jquery.com/jquery-2.1.0.min.js"></script> <script src="//cdn.datatables.net/1.10.2/js/jquery.datatables.js"></script> <script src="//cdn.datatables.ne...

I want to send data from node.js to C# -

I want to send data from node.js to C# - i work on asterisk ami node.js server want send info [node.js server] c# client in real time server.js var app = require('http').createserver().listen(3001); var io = require('socket.io').listen(app); var asteriskami = require('asterisk-ami'); var ami = new asteriskami( { host: '127.0.0.1', username: 'admin', password: '123456' } ); io.sockets.on('connection', function(socket) { socket.emit('notification', {message: "connected"}); }); ami.on('ami_data', function(data) { io.sockets.emit('ami_event', data); // or same // io.emit('ami_event', data); }); ami.connect(function(){ }); c# sharp client using system; using system.io; using system.net; using system.net.sockets; using system.text; class mytcplistener { public static void mai...

python - Concise way updating values based on column values -

python - Concise way updating values based on column values - background: have dataframe values need update using specific conditions. original implementation inherited used lot nested if statements wrapped in loop, obfuscating going on. readability in mind, rewrote this: # other widgets df.loc[( (df.product == 0) & (df.prod_type == 'otherwidget') & (df.region == 'us') ), 'product'] = 5 # supplier x - clients df.loc[( (df.product == 0) & (df.region.isin(['uk','us'])) & (df.supplier == 'x') ), 'product'] = 6 # supplier y - client df.loc[( (df.product == 0) & (df.region.isin(['uk','us'])) & (df.supplier == 'y') & (df.client == 'a') ), 'product'] = 1 # supplier y - client b df.loc[( (df.product == 0) & (df.region.isin(['uk','us'])) & (df.supplier == ...

php - Filter wordpress-menu by category name -

php - Filter wordpress-menu by category name - i need filter wordpress-menu category name. what found far next loop, gives me menu-items: function exclude_menu_items( $items, $menu, $args ) { // iterate on items search , destroy foreach ( $items $key => $item ) { //if ( $item->object_id == 168 ) unset( $items[$key] ); print_r($item); echo '<br>'; //var_dump(get_the_category($item->id)); //echo get_query_var('cat'); } homecoming $items; } add_filter( 'wp_get_nav_menu_items', 'exclude_menu_items', null, 3 ); i added capability pages have categories this: function add_categories_for_pages() { register_taxonomy_for_object_type('category', 'page'); } add_action( 'init', 'add_categories_for_pages' ); but how can pages category menu item? seems have found solution, don't know if it's best far seems work: function ex...

postgresql - how install postgres (for rails) on vagrant so "vagrant" role does not have to be manually created? -

postgresql - how install postgres (for rails) on vagrant so "vagrant" role does not have to be manually created? - how can install postgres under vagrant runs in development mode same running postgres.app... no user or password required? moving rails 3.2.21 development environment on vagrant, if leave database.yml file as-is, error fatal: role "vagrant" not exist when run rake db:create if modify config/database.yml adding username: postgres password: postgres it works. "breaks" database connection developer not using vagrant (becasue using postgres.app on development machine not utilize user or password). , want abel run vagrant up without having manually create postgres user using psql each , every time. is there, example, way have vagrant-specific database.yml gets used when running rake , rails under vagrant? postgresql vagrant

syntax - C# goto use - what else to use here? -

syntax - C# goto use - what else to use here? - i know using goto people avoid, have read on various places useful if need simple code. have simple programme needs repeated if user selects so: static void main() { restart: ... string userchoice=console.readline(); if (userchoice=="y") goto restart; } is using goto here bad? cannot see other way how repeat code without doing loops etc. seems straightforward , clean way. or missing something? string userchoice; { userchoice=console.readline(); } while (userchoice=="y"); c# syntax goto

ios - Is it possible to cache HLS segments with AVPlayer? -

ios - Is it possible to cache HLS segments with AVPlayer? - root problem​ our video buffers lot when seeking in ios. buffers quite bit more our web player saves copies of watched segments in temp storage. ​desired solution​ caching video segments locally on device's disk. we're fine caching single quality , replaying it. ​blocker​ we can't find way perform caching within avfoundation/avplayer. what we've tried 2 ways intercept networking requests avplayer. conforming ​avassetresourceloaderdelegate ​and handling loading of media manually doesn't work hls. can load m3u8 files implementing avassetresourceloaderdelegate​, allows pass authentication or decrypt response, .ts files can't loaded. here's code tried: https://gist.github.com/nathanhillyer/84e46152d7c4c88183b6 implementing nsurlprotocol ​to capture requests .ts files. avurlasset avoids beingness intercepted. somehow network requests don't captured. (no clue why) ...

javascript - Swift search function -

javascript - Swift search function - the next javascript have functions after "swift " same thing. search working on html file not on table every search tutorial have seen does. not asking code translated, although great, after somewhere find out can larn how write similar function me same results. help great. <script> function findnext () { var str = document.getelementbyid ("findinput").value; if (str == "") { alert ("please come in text search!"); return; } if (window.find) { var found = window.find (str); if (!found) { alert ("the next text not found:\n" + str); } } } </script> javascript swift search uiwebview

php - Connection Refused in mail - Magento -

php - Connection Refused in mail - Magento - i'm using smtp pro self extension. it's working fine in local server, when i'm hosting in website, i'm getting below error: smtp pro self test results sending test email contact form address: vin@yahoo.com from: vin@gmail.com unable send test email. exception message was: connection refused please check user guide frequent error messages , solutions. default templates exist. email communications enabled. please help me resolve this. php email magento

php - The success Function in Ajax Doesn't work When using Json -

php - The success Function in Ajax Doesn't work When using Json - i have login form shows in dialog box in jquery need pass variable php jquery using ajax & json method problem success function in ajax doesn't work , error function here's both php , jquery code: jquery: $(document).ready(function () { $(".logbut").click( function () { $(".login").dialog({ width: 400, height:320, modal: true, autoopen: true, resizable: false, show: { effect: "blind", duration: 3000 }, hide: { effect: "drop", duration: 1000 }, buttons: { 'login': function() { $.ajax({ url:"login.php", type: 'post', datatype:"json...