Posts

Showing posts from April, 2015

c# - Regain focus after flyout closed in a Store App -

i have flyout page use login. store username in localsettings , fine point. after login want pagetitle of page like: "welcome: " + username. (where username stored in localsettings). this works. after reloaded mainpage example going page , again or when close entire app , start again. doesn't work right away after "login in" localsettings being loaded when page started not when running. is there way "reload" mainpage after flyout closes? there can execute when mainpage gains focus? might there method regaining focus(if can't find it). this (a part of) flyout page store variables in localsettings: localsettings.values["settingusername"] = tbusername.text; localsettings.values["settingpassword"] = tbpassword.text; *note : frame.navigate(typeof(page) not work. since flyouts doesn't support that. i found solution, ill share here if else ever needs it. in c# store apps there checks if screen got focus. add...

Get the price of an item on Steam Community Market with PHP and Regex -

i'm trying use php steam community market price of item. take url (for example : http://steamcommunity.com/market/listings/730/stattrak%e2%84%a2%20p250%20%7c%20steel%20disruption%20%28factory%20new%29 ) , download content file_get_contents(). tried use : function getinnerhtml($string, $tagname, $closetagname) { $pattern = "/<$tagname ?.*>(.*)<\/$closetagname>/"; preg_match($pattern, $string, $matches); return $matches[1]; } using getinnerhtml($str, 'span class="market_listing_price market_listing_price_with_fee"', 'span'); an example of can have file_get_contents : <span class="market_table_value"> <span class="market_listing_price market_listing_price_with_fee"> $1.92 </span> <span class="market_listing_price market_listing_price_without_fee"> $1.68 </span> <br/> </span> but retur...

java - Jackson annotations not used with Spring boot -

i using spring boot 1.0.1.release , trying pick jackson annotations. more specifically, trying use @jsonmanagedreference , @jsonbackreference annotations. idea why might ignored? tried @jsonignore did not seem picked up. i tried 2 things mentioned in question (moving jackson annotionations first , using list instead of set ). looked @ this question on spring forums , not me either. update: this componenttype class: @entity public class componenttype { // ------------------------------ fields ------------------------------ @id @generatedvalue() private long m_id; private string m_name; @jsonmanagedreference @onetomany(cascade = cascadetype.all) @joincolumn(name = "parent_id") private list<componentsubtype> m_subtypes; // --------------------------- constructors --------------------------- public componenttype() { } public componenttype( string name, iterable<componentsubtype> subtypes ) { ...

c# - DependencyProperty of Custom Type won't fire propertychanged callback -

premise: read others threads similar issues none of solved problem. i have usercontrol (summarysource) 3 dp: public static dependencyproperty queryproperty; public static dependencyproperty maxrowsperpageproperty; public static dependencyproperty opcsessionproperty; and respective public getters , setters: [category("common")] public string query { { return (string)getvalue(queryproperty); } set { setvalue(queryproperty, value); } } [category("common")] public uint32 maxrowsperpage { { return (uint32)getvalue(maxrowsperpageproperty); } set { setvalue(maxrowsperpageproperty, value); } } [category("common")] public uasession opcsession { { return (uasession)getvalue(opcsessionproperty); } set { setvalue(opcsessionproperty, value); } } the problem tha propertychanged callback "opcsession" variable (the 1 custom type) isn't fired. static constructor opcsessionproperty = dependencyproperty.register(...

c - Cannot print characters from a file -

i trying read file character character , print on screen. however, character not displaying, getting box 0001 in it. code #include <stdio.h> #include <stdlib.h> int main() { file *fp; int ch; fp=fopen("myfile.txt", "rb"); while((ch = getc(fp)) !=eof){ putc(ch, stdout); } fclose(fp); return 1; } you need check return values fopen, ensure opened file successfully, executing wrong directory. plus if file text file, should opening using "rt".

build.gradle - Gradle javaexec task is ignoring jvmargs -

i trying run app using gradle javaexec task. however, jvmargs , args not passed command execution. why? task runargodev(type: javaexec) { main = "org.app.argodevrunner" classpath = configurations.testruntime project.ext.jvmargs = ['-xdock:name=argo', '-xmx512m', '-dfile.encoding=utf-8', '-dapple.awt.textantialiasing=on', '-ea'] project.ext.args = ['-initparameter', 'implicit-scrollpane-support=true'] } above code doesn't have desired effect because sets properties on project object, instead of configuring task. correct jvmargs = ... , args = ... . (it's possible omit = , [ , , ] .)

openerp - How do I make a new tree view for res.partner without inheriting the default tree? -

i need make alternate tree view res.partner. this code <record id="custom_res_partner_tree_view" model="ir.ui.view"> <field name="name">custom</field> <field name="model">res.partner</field> <field eval="1" name="priority"/> <field name="arch" type="xml"> <tree string="contacts"> <field string="1" name="custom_field1"/> <field string="2" name="custom_field2"/> <field string="3" name="name"/> <field string="4" name="street"/> <field string="5" name="phone"/> <field string="6" name="email"/> </tree> </field> </record> ....... <record model="ir.actions.act_wi...

c++ - What do the Boost.Python ImportErrors mean? -

experimenting boost.python, stumbled across errors this: $ ld_library_path=. python >>> import tackle traceback (most recent call last): file "<stdin>", line 1, in <module> importerror: ./tackle.so: undefined symbol: _zn6tackle12tgamesessiond1ev now, mean? know importerror , that's straight forward. tackle.so object file failed import, undefined symbol means expected symbol (constructor, variable, ...) not defined, tackle namespace , tgamesession class. but _zn6 , 12 , d1ev mean? is there documentation regarding these error-messages? after bit of guessing, found out it's copy-constructor in case. how should know, apart random guesses?

Android Java - How to download zip file from URL? -

hey im making new project requires download files dropbox. added new class called downloadfile has code download file. reason app crashes when click download. thanks. heres downloadfile: package com.matt7262.download.app; import android.support.v7.app.actionbaractivity; import android.os.bundle; import android.view.menu; import android.view.menuitem; //chat bot library import org.alicebot.ab.chat; import org.alicebot.ab.bot; import android.view.view; import android.widget.button; import android.os.environment; import android.widget.textview; import android.widget.toast; import java.io.inputstream; import java.net.url; import java.io.datainputstream; import java.io.dataoutputstream; import java.io.file; import java.io.filenotfoundexception; import java.io.fileoutputstream; import java.io.ioexception; import java.net.httpurlconnection; import java.net.malformedurlexception; import a...

python - How to quit the program in while loop using push-button in PyQt -

i have following code start after clicking 'start' button in pyqt: def start(self): import time import os import rpi.gpio gpio import datetime gpio.setmode(gpio.bcm) debug = 1 os.system('clear') # spi port on gpio spiclk = 18 spimiso = 23 spics = 25 # set spi interface pins gpio.setup(spimiso, gpio.in) gpio.setup(spiclk, gpio.out) gpio.setup(spics, gpio.out) gpio.output(spics, true) gpio.output(spics, false) # bring cs low while true: adcout = 0 read_adc = 0 #s=time.clock() in range(25): gpio.output(spiclk, true) gpio.output(spiclk, false) adcout <<= 1 if (gpio.input(spimiso)==1): adcout |= 0x1 time.sleep(0.085) if (gpio.input(spimiso)==0): read_adc = adcout millivolts = read_adc * ( 2500.0 /(pow(2,22))) read_adc = "%d" % read_adc mill...

c# - Notifying about task finishing its work -

i'm thinking of simple way of reacting on task finishing work. came following solution (paste winforms application single button test): public partial class form1 : form { private thread thread; public void dofinishwork() { // [4] // ui thread - waiting thread finalize work thread.join(); // checking, if finished work messagebox.show("thread state: " + thread.isalive.tostring()); } public void dowork() { // [2] // working hard thread.sleep(1000); } public void finishwork() { // [3] // asynchronously notifying form in main thread, work done delegate del = new action(dofinishwork); this.begininvoke(del); // finalizing work - should switched // @ point main thread thread.sleep(1000); } public form1() { initializecomponent(); } private void button1_click(object sender, eventargs e) { ...

What is this strange function definition syntax in C? -

this question has answer here: alternative (k&r) c syntax function declaration versus prototypes 6 answers i've seen few function definitions while playing gnu bison: static value ripper_pos(self) value self; { //code here } why type of self outside of parenthesis? valid c? those old k&r style function parameter declarations, declaring types of parameters separately: int func(a, b, c) int a; int b; int c; { return + b + c; } this same more modern way declare function parameters: int func(int a, int b, int c) { return + b + c; } the "new style" declarations universally preferred.

angularjs - All values in array bound to same value -

i'm trying update values inside $scope.match.teams[0] vaules players' names, when input in single field, bound every players' name team. controller: $scope.match = { teams: [ { id: 0, name: "", players: [ { id: 1, name: "" }, { id: 2, name: "" }, { id: 3, name: "" }, { id: 4, name: "" }, { id: 5, name: "" }, { id: 6, name: "" }, { id: 7, name: "" }, { id: 8, name: "" }, { id: 9, name: "" }, { id: 10, name: "" }, { id: 11, name: "" }, ] }, { id: 1, name: "", players: [ ...

Can a object be instanced as null ? (php) -

i don't understand behavior in php (since 5.4 ? ) class test { function __construct() { return null ; } } ; $a = new test() ; if($a) { echo "i printing this. why printing ??" ; } $a should equal null passes test if()... in case (if arguments invalid exemple) possible null object when using 'new' ? constructors not return anything. after ctor has run, object has been created. return null ignored. edit: if possible return null in ctor when failed bad practice. throw exception clear message instead. help page: http://www.php.net/manual/en/language.exceptions.php

SQL Server LCK_M_S only happens in production -

i have stored procedure called sql server 2012 report taking age run in production compared development because of blocking session lck_m_s the stored procedure runs instantaneously when executed in sql server management studio , works when called part of report dev laptop via visual studio. when report uploaded production server blocking issue appears. how can find out causing lck_m_s issue when in production? execute query when problem happens again: select * sys.dm_os_waiting_tasks t inner join sys.dm_exec_connections c on c.session_id = t.blocking_session_id cross apply sys.dm_exec_sql_text(c.most_recent_sql_handle) h1 it give spid of session caused blocking, on resource blocked, , text of rcent query session. should give solid starting point.

mysql - Insert into SQL from CSV -

i have following csv file: africa,zimbabwe,7,telecel zimbabwe,1,0,1,0,0,1 africa,zambia,7,celtel zambia plc,1,0,1,0,0,1 i using following query reason it's giving error: load data local infile 'pathtofile' table databasename.tablename fields terminated ',' enclosed '"' lines terminated '\n'; it giving data truncated warning , not importing anything first of need ensure receiving data fields in correct order , of correct type , size. then specify enclosed '"' , example data not enclosed...

html - Wrap lines without breaking words -

i want wrap test in paragraph without breaking words it. words breaked while wrapping. e.g. "hello world programmers" becomes "hello world progr ammers" i want behave like "hello world programmers" i've used word-break:keep-all property doesn't solve problem. doing wrong. please tell me. thanks. don't use word-break (or set normal ) , should fine.

java - How to run HTML5 on eclipse ADT to create Android application -

i have android developer tool build: v22.3.0-887826 product includes eclipse platform, jdt, cdt, emf, gef , wtp , want program html5 create android application on version of eclipse , possible? , mean run html5 on eclipse? you can't (and don't) run html5 on eclipse. it possible create android application html5 though. there several ways of doing it. can find literally tons of information searching google html5 android app development - you'll find need. spend time researching - , you'll answer. one of common frameworks sencha touch - again, spend time researching - you'll answer.

reactive cocoa - ReactiveCocoa finally never be called with already completed replaySubject. Is it expected behavior? -

is expected behavior? racsubject *subject = [racreplaysubject replaysubjectwithcapacity:1]; [subject sendcompleted]; [subject finally:^{ nslog(@"never called"); }]; [subject subscribecompleted:^{ nslog(@"called"); }]; if so, how have finally block? need this? void (^block)() = ^ { nslog(@"like finally!"); }; [subject subscribeerror:^(nserror *error) { block(); } completed:^{ block(); }]; edit: misunderstand finally me, the document renamed dofinished in rac 3.0 may understand, instead of the 2.x document . it's unrelated fact signal has completed. consider this: racsubject *subject = [racsubject subject]; [subject finally:^{ nslog(@"never called"); }]; [subject subscribecompleted:^{ nslog(@"called"); }]; [subject sendcompleted]; still never called! why? because finally: returns new signal; doesn't modify existing signal. new signal perform side effects whenever sends comp...

Javascript Date Object incosistency in month numbering? -

i'm confused date in js... know months numbered 0-11, sa creating var x = new date(2014, 2, 1) will give me 1st of march . creating var x = new date(2014, 2, 0) gives february , x.getdate() give me not number of days in march, in february... should rather return days of march if number 2 (with numeration 0)? also there way set monday first day of week in getday() method? the months ranges 0 11.0 being january wheres day of month start 1, if use 0 in day gives previous months last day.so in case should use var x = new date(2014, 1, 1) // 1st feb 2014 you can change start of week monday follows date.prototype.mgetday = function() { return (this.getday() + 6) %7; } refer article details

ios - How can i build a URL with same key multiple times? -

i'm building ios app makes get requests url. requests makes, build url off base url , add parameters using nsdictionary key-value_pairs. i use afnetworking 2.0 make request - builds url well, nsdictionary keys supplied. i have run problem, web service need use, requires multiple keys same, different values. functionality not possible nsdictionary which means cannot run web service successfully. here example of need url - http://demo.domain.net/services/ .... .&includeduserids=12345&includeduserids=2345 the italic bit of above url trying build using afnetworking , nsdictionary. suspect have use little more advanced nsdictionary pull off. does have ideas? edit found half solutions if set nsdictionary parameters nsset: [self.parameters setobject:[nsset setwithobjects:@"12345",@"2345", nil] forkey:@"includeduserids"]; this works need to. have follow question: the values need dynamically added nsset - how cre...

php - Cache ODBC characters -

ok our database intersystems cache, i'm trying values 1 table via php. managed values values incomplete , have symbols @ end. this characters.. php99¥7“\ߦ then tried values via crystal reports.. no symbols still long values incomplete, viewed field type , says string[30], thought it's limited 30 characters. when viewed in vb application shows more 30 characters. example: php = "the quick brown fox jumps overphp99¥7“\ߦ" crystal reports = "the quick brown fox jumps over" vb application = "the quick brown fox jumps on lazy dog" i don't have source of vb can't see sql running. anyone can meh...? when working directly globals in caché constraints of length of columns of table not verified. way possible put info longer max length of column row. on other hand odbc , crystal reports (i think use odbc in background) base column length on definition of table. the easy solution in case rising length of column in questio...

android - How to link against a external jar in Ant? -

i have library uses external jar. (unity's stuff) how can link agains ant jar command succeeds? quite new ant kind of lost... i've tried adding new property: <property name="unity.androidplayer.jarfile" value="/applications/unity/unity.app/contents/playbackengines/androiddevelopmentplayer/bin/"/> <path id="classpath"> <fileset dir="${unity.androidplayer.jarfile}" includes="**/*.jar"/> </path> and adding "compile" target <target name="compile" description="compiles project's .java files .class files"> <javac encoding="ascii" debug="true"> <src path="${source.dir}" /> <classpath> <pathelement location="${sdk.dir}\platforms\${target}\android.jar"/> <pathelement location="${unity.androidplayer.jarfile}"/> </classpath> ...

scala - How to use fsc with sbt? -

related question: does sbt use fast scala compiler (fsc)? can fsc used sbt; practical; , if so, how integrate fsc sbt? fsc cannot used sbt. https://github.com/sbt/sbt/wiki/client-server-split shows sbt team working in similar/related direction. they're turning sbt local compile server — like fsc better. wouldn't surprised if once they're done, fsc deprecated , removed scala. (fsc has never worked or been actively maintained.)

sql - updating select query-1 using select query-2 in the same table -

please help.how accomplish following: the table holds daily transaction data . aim update/insert values 3 of columns in current day's records using calculated values (of 3 columns) of yesterday's records . have last 40 days update based on: trunc(sysdate)-39 = calculated value of trunc(sysdate)-40 trunc(sysdate)-38 = calculated value of trunc(sysdate)-39 trunc(sysdate)-37 = calculated value of trunc(sysdate)-36 . . . . trunc(sysdate)= calculated value of trunc(sysdate)-1. example of code: marge (select trans_date, store, item, reason, col1, col2, col3 tb1 tb1.trans_date = trunc(sysdate)) today using (select trans_date, store, item, reason, col1, col2, col3 tb1 tb1.trans_date = trunc(sysdate-1)) yesterday when matched update set (today.col1 = yesterday.col1 + 1 today.col2 = decode(yesterday.reason,today.reason,today.col2+1,1) today.col3 = yesterday.trans_date) when not matched insert (today.col1, today.col2, today.col3 ) va...

ruby on rails 3 - MongoDB with MongoID Fetching few fields in Find Query -

i'm trying write restful web api's, have collection called community, , has 10 fields. in getcommunityapi call want pass on necessary information mobile device. i've referred blog example , has suggested following mongodb query $db->users->find({}, {username => 1}); i've written mongoid search @result=@result.find({},{:username=>1}) but gives me error not able find valid document id = {} i've tried @result=@result.only({:username=>1}) but instead of returning username returns making other field null. {"_id":"534186e5414fc34bc5000002","ad":null,"ae":null,"cat":null...and on} my question is, in order make api calls efficient. consuming least amount mobile data possible send fetch data mongodb in following format {"_id":"534186e5414fc34bc5000002"} this approach make api's sending valid information, , mobile network friendly. i'm expecting 1000's ...

c++ - My Prim's Algorithm (MST) runs much faster in a matrix than in a list -

i have trouble implementing prim's algorithm finding minimum spanning tree in graph. 1. generate adjacency matrix, , run algorithm work on matrix. code: void graph::prim(){ int i=,j; int x=0,y=0,min,count=0; bool* visited=new bool[this->vertices_number]; // array of visited vertices (int a=0;a<this->vertices_number;a++) visited[a]=false; visited[0]=true; // checking first vertex (start looking here) while(count < this->vertices_number-1){ min=infinity; //defined in header (large int) (int i=0;i<this->vertices_number;i++){ if (visited[i]==true){ // looking minimum-weight edge in visited vertices for(j=0;j<this->vertices_number;j++){ //looking in 1 column if (this->adjacencymatrix[i][j]<min && this->adjacencymatrix[i][j]>0 && visited[j]==false){ /* looking ...

c# - Access objects in UserControl from MainWindow in WPF -

i have simple xaml, how can change text property of textblock in usercontrol1 mainwindow ? <window x:class="refactorxaml.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:refactorxaml="clr-namespace:refactorxaml" title="mainwindow" height="350" width="525"> <grid> <grid.rowdefinitions> <rowdefinition height="100"></rowdefinition> <rowdefinition height="100"></rowdefinition> </grid.rowdefinitions> <grid> <refactorxaml:usercontrol1></refactorxaml:usercontrol1> </grid> <grid grid.row="1"> <button>change text</button> </grid> </grid> </window> <usercon...

function key pressed javascript -

i can not understand various steps of function, can explain them? function keypress(field,e,x) { if (!e) { var e = window.event; } if (e.keycode) { code = e.keycode; } else if (e.which) { code = e.which; } var character = string.fromcharcode(code); console.log("character" + character); if (code == 13) { box.focus(); } } if (!e) { var e = window.event; } if e (the event variable) not defined, set window.event . makes sure have necessary data in variable e . if (e.keycode) { code = e.keycode; } else if (e.which) { code = e.which; } browser specific tests; browser (as far know ie) uses e.wich , other browser use e.keycode . indicates key pressed user. var character = string.fromcharcode(code); console.log("character" + character); converts code char. if (code == 13) { casella2.focus(); } checks if enter key pressed, if so, casella2 focused. you can ...

mysql - uploading file to server with php code -

i want write php code that's update existing data on mysql table , uploading file server... everithing working, file upload doesn't. if can me out this, apreciate that! code: <?php // personal data assignment if ($_session['username'] == "zdraci"){ require('config.inc'); $target = 'galab-kepek/'; $tablename = "data_laci"; } if ($_session['username'] == "styven"){ require('config2.inc'); $target = 'galab-kepek2/'; $tablename = "data_timi"; } //get form data $gyuruszam = $_request["gyuruszam"]; $new_gyuruszam = $_post["gyuruszam-new"]; $apja = $_post["apja"]; $anya = $_post["anya"]; $baknyosteny = $_post["baknyosteny"]; $megjegyzes = $_post["megjegyzes"]; $pic=($_files['photo1']['name']); if($pic == null || $pic == ""){ $pic = "nincs k&#233p!"; } //this direc...

php - Sort sub array by total charges -

i want perform sorting total_charges. mongodb data following { "_id" : objectid("534bceb303ea2ecd1de86944"), "hotel" : [ { "0" : 0, "hotelid" : "123", "name" : "hotel - demo1", "city" : "paris", "address1" : "demo -paris ", "total_charges" : 1653.76, "propertyavailable" : 1 }, { "0" : 0, "hotelid" : "134", "name" : "hotel - demo2", "city" : "paris", "address1" : "demo paris ", "total_charges" : 1875.71, "propertyavailable" : 1 }, { "0" : 0, "hotelid" : "145", ...

c# - Which kinds of reordering optimizations do x86 CPUs do? -

in blog post , eric lippert says that: i note on x86-based hardware particular reordering of writes never observed; cpus not perform optimization. does mean x86 cpus not have of issues talked when discussing volatility , reordering of reads , writes, or mean in example cpu won't reorder? what types of reorderings can happen in x86_64 cpu , under circumstances? does mean x86 cpus not have of issues talked when discussing volatility , reordering of reads , writes, or mean in example cpu won't reorder? it means stores not rearranged in x86 cpus; loads can still moved backward through. then, important understand x86 means. in context of post, means x86 , not derivatives. x86 oostore architecture enables far more memory reordering basic x86 implementation. can details here: http://en.wikipedia.org/wiki/memory_ordering there plenty of examples around use case following: http://preshing.com/20120515/memory-reordering-caught-in-the-act/ http://mo...

salesforce - Updating OpportunityProducts using Opportunity Trigger -

i use calculation on opportunity products (i.e.line items) uses term of opp stored in opp (ex: oli.recurringamt = opp.term * oli.unitprice * oli.quantity) if valdue of term (integer) in opp changes, math in each oli needs updated manually. i'm proposing use trigger on opp update time term changes. here's question: since amount field in opp auto-calculated sfdc sum of unitprice of each related line item times quantity, every line item, run recursion problems updating oli records opp trigger will, default, try update amount field of same opp firing trigger? if not cause issues, should trigger on "after update" or "before update"? , sfdc recalculate updated amount value before or after trigger completes? thanks insight on this. trigger recursion occur in case if changing opportunitylineitem (oli) unitprice or quantity. the standard practice use static member or property within transaction detect if operation has been performed. see how...

java - How to maintain user data state when user is not logged in and the client machine crashes? -

there web application shopping chart, user can pick products p1 page 1, p3 page 3 , p7 page 7. he can move ahead , presented total amount , payment transaction take place. suppose user has selected products , computer crashes, again logs in find out he's product selection vanished. how manage handle such situation ? you either go cookes or html 5 local storage. suggest latter. have here detailed information: http://diveintohtml5.info/storage.html

Creating a FRIEND RELATION in MySQL and PHP -

Image
i creating system keep relationships in application. when says stored in database id, , friend (in order). , when other person accepts request id of friend , other id (in reverse order) saved. to verify 2 friends have see there these 2 rows. the last problem when true, have retrieve name of friend table .. , not know how express in php. i've been testing, , should this. here code: select nombre users join friends (id=usuari_o or id=usuari_t) , (usuari_t='$id' or usuari_o='$id') friends tables structure: users table structure: something this: select original.nombre original_nombre, friends.usuari_o, target.nombre target_nobmre, friends.usuari_t friends left join users original on original.id = friends.usuari_od left join users target on target.id = friends.usuari_t;