Posts

Showing posts from July, 2013

javascript - Simple mulch caculator won't fire on click and no error. jQuery and straigt js -

i'm attempting convert straight javacript function fire jquery .click i'm not getting output errors yet wont perform calculation on jsfiddle. var form = document.product_form_top; function process(v) { var value = parseint(document.getelementbyid('item_qty').value); value += v; document.getelementbyid('item_qty').value = value.tofixed(0); } function calculate() { form.cubicyards.value = (form.length.value / 3) * (form.width.value / 3) * (form.depth.value / 35); document.getelementbyid('yards').innerhtml = finaloutput var number = parsefloat(form.item_qty.value); var finaloutput = number.tofixed(0); form.item_qty.value = form.cubicyards.value * 14.7; //calculate yards var number = parsefloat(form.cubicyards.value); var finaloutput = number.tofixed(0); document.getelementbyid('item_qty').innerhtml = finaloutput form.weightpounds.value = (form.length.value / 3) * (form.w

Greater Than and Less than MySql query failing with decimal field -

i have database has 3 columns: user_id | lat | lon 1 |-1.403976 | 53.428692 2 |-1.353276 | 55.224692 etc etc both lat , lon set decimal fields. i'm running query similar isn't filtering based on being greater , less given lat/lon numbers: select * `table` `lat` < '-1.399999' , 'lat' > '-1.300000' , 'lon' < '55.555555' , > '53.000000' this query returns every row in table , don't know why? fields being set decimals? i hope can - know simple answer if know it. as per comment - here's create table: create table if not exists `members` ( `user_id` int(10) not null auto_increment, `lat` decimal(8,6) not null, `lon` decimal(8,6) not null, unique key `user_id` (`user_id`), ) engine=innodb default charset=latin1 auto_increment=136 ; the problem wrapping column names single quotes forcing decimal values compare against string literals. column names tables name identif

html - Javascript Prompt Cancel Button not "Canceling" -

i've noticed when have user enter text through prompt window, prompt return null , continue moving on code. want cancel button says , cancel. i've tried several if statements, including: var x= prompt("please enter number <x>: (<x> + <y>)"); if (x === null) { return; } var y= prompt("please enter number <y>: (<x> + <y>)"); if (x === null) { return; } eval ("x=x; y=y; alert(+x + + y)"); }; the above not change anything var x= prompt("please enter number <x>: (<x> + <y>)"); if (verifyinput(false)) { return; } var y= prompt("please enter number <y>: (<x> + <y>)"); if (verifyinput(false)) { return; } eval ("x=x; y=y; alert(+x + + y)"); }; and 1 makes both ok , cancel buttons return false, , code not continue when ok pressed. is code affect cancel button stops script continuing? thanks! i

php - Adding a new key value pair to a JSON object where key has a random ID -

this question has answer here: php dynamic name object property 2 answers i know how add new key value pair json through php like: $json->newobject = "value"; what can't figure out how give key of pair, random id. i've tried like: $id = rand(99, 9999); $json["newobject" . $id] = "value"; with error of: fatal error: cannot use object of type stdclass array in /home/methodjs/public_html/projects/chat/send.php on line 8 and: $id = rand(99, 9999); $json->("newobject" . $id) = "value"; with error of: parse error: syntax error, unexpected '(', expecting t_string or t_variable or '{' or '$' in /home/methodjs/public_html/projects/chat/send.php on line 8 there must simple way this, hope. help. sorry dublicate this want: $json->{"newobject".$id} =

javascript - How to automatically scale pixel positions in HTML5 Canvas? -

Image
i have created html5 based drawing application used html5 canvas element . have written code draw sketches on canvas . the original size of canvas 500 px x 500 px . drawings made according . problem need change canvas size 1000 x 1000 , want make drawings cover entire new canvas . there easy way rather tinker pixel positions directly ? you change canvas size using css , keep width , height properties of canvas element constant. create stretching need.

android - What is battle formula of strategy game? -

i try find algorithm strategy game battles travian or lord of ultima or ... every program wrote had bug calculating dead soldiers, examples of critical points is: in real world when 100 soldiers attack 1 soldier,its usual 100 soldiers alive , 1 defender soldier dead. finding winner of battle data example is: attacker: soldiers | defending-power | attacking-power | soldier count | ---------|-----------------|-----------------|---------------| | 20 | 45 | 5 b | 22 | 77 | 4 c | 41 | 32 | 7 d | 38 | 54 | 6 e | 27 | 41 | 6 defender: soldiers | defending-power | attacking-power | soldier count | ---------|-----------------|-----------------|---------------| | 44 | 12 | 6 b | 59 | 18 | 6 c | 73 | 40 | 7 d | 26

c# - Error when displaying data in a datalist from sqldatasource in asp project -

i building website class , have come across error can not find solution to. have dropdownlist on page displays cutomer name , sets selected value customer id selected sqldatasource (data tables access database - fig1 ) (this works fine have tested before added second sqldatasource). add datalist control page , second sqldatasource datalist bind to. configured datasource using configure data source wizard shown in fig2 . use wizard test data returned query , see works, wizard shows data wanted returned. bind datalist data source , itemtemplate (in html source view) contains data bound labels show values: products.name: <asp:label id="products_namelabel" runat="server" text='<%# eval("products.name") %>' /> <br /> technicians.name: <asp:label id="technicians_namelabel" runat="server" text='<%# eval("technicians.name") %>' /> <br /> incidents.dateopened: <asp:label id

c# - Drawing match pairs in image-calculated by KNN and the potential bug in Features2DToolbox.DrawMatches -

Image
i wrote code finds k closest matches knn algorithm. after getting matmatch , matchindices tried draw match pairs between 2 consequence frames. i feed matmask , matchindices function features2dtoolbox.drawmatches : image<bgr, byte> imresult = features2dtoolbox.drawmatches(immodelcurr, immodel.keypoints, imobserprev,imobser.keypoints, **matchindices**, new bgr(system.drawing.color.yellow), new bgr(system.drawing.color.red), **matmask**, features2dtoolbox.keypointdrawtype.not_draw_single_points); http://www.emgu.com/wiki/files/2.4.0/document/html/e92d37e6-fe4a-ad09-9304-cd2d2533bfa8.htm noticed gives me wrong drawing between matching pairs: then tried implement such function myself: (int = 0; < matmask.rows; ++i) { if (**matmask[i, 0]** > 0) { int indforcurrfrm = **matchindices[i, 0]**; int indforprevfrm = i; //for frame i-1 pointf fromfirstframe = getimgobs

Haskell Parsec parser for an expression starting with a word or parenthesis, ending with end of word or a parenthesis -

i'm trying figure out how write haskell parsec parser consuming of these ruby expressions: hello("test", 'test2') my_variable hello(world("test")) (hello + " " + world) when parser starts parsing @ beginning of of these items, should return whole string , stop parsing @ end of item. if of these items followed comma, comma should not consumed. i've tried few times write parser these types of expressions no success. it's not necessary parse sub-components of these expressions -- don't need full ast. need consume , capture these sorts of chunks. i thought maybe adequate heuristic involve balancing parentheses , eating content within outer balanced parentheses, in addition preceding identifier. need writing parser works way. it doesn't make sense try parse without parsing everything . either (a) write structured, correct parser, or (b) write eats input, counting , tracking doesn't parse it. you&

asp.net - SQL Server aggregate rows into column values -

first time post on site i've used lot in past. did try search answer couldn't nail down how frame question properly, here goes. i have table each row has evaluation number of 1, 2, 3 or 4. each row has id foreign key membership table, , id foreign key other data related row (a table holds test information). what need filter list of records membership group, , create output query of type lists: the test id the number of records evaluated 1 the number of records evaluated 2 the number of records evaluated 3 the number of records evaluated 4 i can work out how count of each evaluation number separately using like: select count(eval), scores.testid membership inner join (scores inner join tests on scores.testid = tests.testid) on membership.id = scores.clientid membership.groupid = <membershipgroup> , scores.eval = 1; where in above main filter, scores.testid 'grouping' id, , count(eval) aggregate want. ideal output is: id |count1|count2|co

html - Why "container1" is not displaying? -

i'm having problem div (container1), does't show on webpage view, done editing on cascading style sheet , browse in google, unfortunately still doesn't solve problem. see below: css * { margin: 0; padding: 0; } html { height: 100%; } header, nav, section, article, aside, footer { display: block; } body { font: 12px/18px arial, tahoma, verdana, sans-serif; height: 100%; } { color: blue; outline: none; text-decoration: underline; } a:hover { text-decoration: none; } p { margin: 0 0 18px } img { border: none; } input { vertical-align: middle; } #wrapper { width: 100%; min-width: 1000px; min-height: 100%; height: auto !important; height: 100%; } /* header ----------------------------------------------------------------------------- #header { height: 150px; background: #ffe680; } */ /* middle -----------------------------------------------------------------------------*/ #content {

ruby - How do I import JavaScript files in Rails 3? -

i've started working ruby on rails, , i'm having difficulty calling javascript functions html. i'm using rails 3.2.13, ruby 1.9.3, , rubymine 5.0.2. i have coffeescript file called "home.js.coffee" in "app/assets/javascripts/" apparently compiles "application.js" in same folder. in "app/views/home/", have html file home page "index.html.erb". have function in "home.js.coffee" called cubes() : cubes = alert math.cube 3 this basic now. want comfortable first. this object called math : math = cube: (x) -> x* square x i created button in index.html.erb should theoretically call function: <button onclick="cubes()">try it</button> the problem getting find javascript file. needs in index.html's head? needs in application.html's head? the problem function in scope. if compile coffeescript -b option, make functions globally available, simple solution be:

Cannot find the class DemoDragHandler in the gwt-dnd API -

can link gwt api contains class com.allen_sauer.gwt.dnd.demo.client.demodraghandler ? i searched everywhere couldn't find it. please help. that's class part of examples of gwt-dnd library. http://code.google.com/p/gwt-dnd/source/browse/dragdrop/demo/com/allen_sauer/gwt/dnd/demo/client/demodraghandler.java you can download full project code (include examples) theirs git repository @ googlecode: git clone https://code.google.com/p/gwt-dnd/ .

jquery - server side scripting in to javascript -

i try latitude , longitude value ip address after getting lat , lng value post in php file using ajax , generate new xml file this html file:- <html xmlns="http://www.w3.org/1999/xhtml"> <head> <script type="text/javascript" src="http://j.maxmind.com/app/geoip.js" ></script> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> <script> function getlg(){ var lan=geoip_latitude(); var lng=geoip_longitude(); var gen = $('#sex').val(); var date = $('#date').val(); $.ajax({ type: "post", url: "http://localhost/svn/trunk/home/url.php?lat="+lan+"&lng="+lng+'&radius'+$('#radius1').val(), contenttype: &qu

backbone.js - How to prevent adding same JSON object or model to collection multiple times? -

i json data via ajax, want add these data collection. want add/update new/existing objects collection. did in 2 ways. both not working, , kind of know why not working. there must solution that. 1) var book = backbone.model.extend({}); var library = backbone.collection.extend({model: book}); var library = new library(); var bookjson = { title: "one thousand , 1 nights", author: "scheherazade" } var book1 = new book(bookjson); var book2 = new book(bookjson); library.add(book1, {merge: true}); library.add(book2, {merge: true}); result library.length = 2 2) var book = backbone.model.extend({}); var library = backbone.collection.extend({model: book}); var library = new library(); var book = { title: "one thousand , 1 nights", author: "scheherazade" } library.add(book, {merge: true}); library.add(book, {merge: true}); result library.length = 2 i want add/update same model/json object once collection. thanks. your json

c# - Threads with common variable -

i'm building nfs joystick manipulating mousewheel events. on main thread call second thread pulses keyboard keys generated frequency. problem frequency dynamically changes in time when move or down mousewheel simulator thread doesn't notice change. fragment of code: int centro = 0; static bool left; static bool ismoving; static int grado; static int frec; thread simulator = new thread(new threadstart(move)); public form1() { initializecomponent(); } static void mleft() { keyboardsimulator.keydown(keys.g); thread.sleep(10); keyboardsimulator.keyup(keys.g); } static void mright() { keyboardsimulator.keydown(keys.j); thread.sleep(10); keyboardsimulator.keyup(keys.j); } static void move() { while (ismoving) { if (left) { mleft(); thread.sleep(frec); } else { mright(); thread.sleep(frec); } } } void map() { if (grado == 0)

coldfusion - How Can I use Two DataSources in a CFQUERY -

<cfquery name="checkinvoice" datasource="?"> select distinct invoice_date,department,value,invoice_no ro_invoice sheet_no='#newrosheet.sheetno#' minus select distinct invoice_date,department,value,invoice_no dbowner.rs_invoices rs_id ='#recordsheet.id#' </cfquery> in above code 1st select statement belongs datasource1 , 2nd datasource2 (in oracle). how can use cfquery execute 2 statements? if both databases oracle (it isn't clear in question) can create database link , query both databases if one. link done in oracle "coldfusion solution" isn't required. oracle has documentation on linking databases here. accessing , modifying information in multiple databases we've used several times during data migration legacy new systems. works well. can use insert , update , , delete once tables linked using easy, using @dblink syntax. <cfquery ...> select

How to match specific number from text - Ruby regex -

id="profile_photo_link" href="/photo83085640_283973341" onclick="return showphoto('83085640_283973341', 'album8308564 0_0/rev', {temp:{base:&quot;http://cs301701.vk.me/v301701640/&quot;,x_:[&quot;181d/n_1czoigh0s&quot;,556,313]}, jumpto: {z: 'albums83085640'}}, event)"> <img width="200" height="205" src="http://cs301701.vk.me/v301701640/4a03/mfkv3wohrqu.jpg " alt="Сергей on-line Консультации Василюк"> how match this(83085640) number text above ruby regex ? start of regex must after showphoto(' text , ends @ point _ after numbers please help! you need following: my_text = "showphoto('83085640_283973341',"; #input string. i'm using part of here convenience. pat = /showphoto\('(\d*)_/; #the regexp pattern per requirements. puts(pat.match(my_text)[1]); output: 83085640

Using Reference in c++ -

i using global instance of class class a; a1; using global variable in other functions using reference a& a2 = a1; such changes done locally reflected globally. wanted check whether destructor a2 called local scope ends? please clarify. a2 reference not have destructor. the destructor a1 called when program exits. expecting happen when a2's local scope ends?

java - Multi-dimensional segment trees -

the problem have solve 4d version of 1d problem of stabbing queries : find intervals number belongs to. looking multi-dimensional implementation of segment trees . ideally, in java , use fractional cascading . multi-dimensional implementations exist kd-trees (k-nn searches) , range trees (given bounding box, find points in it) segment trees i've found 1d implementations. i'd happy consider other data structures similar space/time complexity address same problem. to expand on comment, binary-space-partitioning algorithm have in mind this. choose coordinate x , threshold t (random coordinate, median coordinate, etc.). allocate new node , assign of intervals intersect half-plane x=t it. recursively construct child nodes (a) intervals contained entirely within lower half-space x<t , (b) intervals contained entirely within upper half-space x>t. the stabbing query starts @ root, checks of intervals assigned current node, descends appropriate child, , r

android - Query for getting rows with dates between certian range(stored as string in form of dd-mm-yyyy) -

i have date stored in form of text in sqllite database. format "dd-mm-yyyy". making query select rows having dates in between 2 given dates. when query database query dates belonging same month, getting results. but, when date range belong different month, returns no rows. eg: the problem arises when dates : 29-03-2013 05-04-2013. returns rows when dates between: 02-04-2013 , 05-04-2013. there rows entries made on dates. following ways have tried: // mysqlitehelper.column_date_date stores column name 'date' // startdate , end date string in form of mm-dd-yyyy // mysqlitehelper.table_names contain table name string // mysqlitehelper.column_mood_level column wish in return i have tried using between clause , <= , >=, no effect output. here how: // method 1: string selection = mysqlitehelper.column_date_date + " between '"+startdate+"' , '"+ enddate+"' "; // method 2: string selection = mysqlitehelper.col

xslt - Copy only HTML from mixed xml and HTML -

we have bunch of files html pages contain additional xml elements (all prefixed our company name 'tla') provide data , structure older program rewriting. example form: <html > <head> <title>highly simplified example form</title> </head> <body> <tla:document xmlns:tla="http://www.tla.com"> <tla:contexts> <tla:context id="id_1" value=""></tla:context> </tla:contexts> <tla:page> <tla:question id="q_id_1"> <table> <tr> <td> <input id="input_id_1" type="text" /> </td> </tr> </table> </tla:question> </tla:page> <!-- repeat many times --> </tla:doc

Best way to structure pricing matrix in MySQL? -

i working on site user can: choose product (window blinds) choose color (there 3 groups of colors - a, b , c. price depends on color) enter size of blind (in cm). when user has entered size , clicks enter, ajax call fired php script executes query, looking database , finds appropriate price. the sizes in increments of 10cm. 100, 110, 120, 130 etc. if user writes 115, automatically choose 120 appropriate size/price (it round up). i have made structure, want know if have ideas can optimize faster/better. products | id | sku | name | category | 1 | 010101 | window blind 1 | blinds | 2 | 020202 | window blind 2 | blinds pricing_colors | id | group | color | 1 | | red | 2 | b | green | 3 | c | blue | 4 | d | white product_colors | id | sku | color_id | 1 | 010101 | 1 | 2 | 010101 | 2 | 2 | 020202 | 1 | 2 | 020202 | 3 pricing_matrix | id | sku | color_group | width | height | price | 1 | 010101 | | 100 | 100 |

c++ - How is the correct form to model a reference/pointer to a class in UML? -

you have 2 classes: class , class b. in order become instance, class b needs have member, object of class a. and, class b has features of class a, excluding functionality allows modify object of class a. also class b has features, , reason, not make using inheritance because if object of class (that use instance b) changed, therefore values of instance of class b, must changed. i represent behavior aggregation, there things not sure about. 1 when object of class destroyed, object of class b not (even not make sense object b more, , access of features provoke run time failure). with meant object of class b references object of class a, , not other way around, in normal aggregation object contain object of class b. it mean not aggregation composition? if object don't make sense after end of lifecycle of referenced object? or how behavor should model instead? look here http://en.wikipedia.org/wiki/object_composition#aggregation aggregation on contary not imply

html5 - angularjs localstorage displaying data -

i been tryi'n use angular nowadays. i'm hoping if me why cant fetch localstorage data below codes. [ { "name": "firstname", "email": "email@yahoo.com" } ] service.js getitem: function (item) { var temp = localstorage.getitem(item); if (!temp){ return []; } return json.parse(temp); } controller.js profile.push({ name: 'firstname', email: 'rmail@yahoo.com' }); localstorage.setitem('profiles', json.stringify(profile)); console.log(service.getitem('name') + ' : should output name'); console.log(service.getitem('email') + ' : should output email'); can please try this var array = service.getitem('profiles'); for(var i=0;i<array.length;i++){ console.log(array[i].name, array[i].email) }

c# - How to mock a statically referenced assembly? -

in c# have application.exe , uses library.dll (a compile-time reference). library.dll used communicate hardware, slow. possible create project in visual studio, create library.dll , mock. want able replace dll file without recompiling exe or replacing reference in visual studio. know can load dll @ run time, possible replace statically referenced dll without causing: fileloadexception: located assembly's manifest definition not match assembly reference. (exception hresult: 0x80131040) (i not use strong names) it going pita, trying mimic dll mocking purpose. i suggest put in feature in code, flag indicate wheteher code should run mock mode, not calling/invoke dll/reference @ all.

html - IE10 - tables - alignment not working -

since upgraded ie10, tables on webpage not shown correctly. below example: ! http://i.stack.imgur.com/xoxbt.jpg the head section of table shown correctly seems whole body of table put in 1 (left) column or cell. i searched solution, didn't find useful yet. here code <table class="class" id="id"> <colgroup> <col width="" style="display:none;" /> <col width="190" /> <col width="160" /> <col width="100" /> <col width="170" /> <col width="120" /> </colgroup> <thead> <tr> <td></td> <td>heading1</td> <td>heading2</td> <td>heading3</td> <td>heading4</td> <td>heading5</td> </tr> </thead> <tbody runat="server" id="tbody"> <tr> <td style="display: none;">id</td> <td><div style=&q

windows - Build and override a simple Winelib DLL -

i have windows executable load library , want create winelib dll overide windows dll. it's been 2 days search , try won't work ! please me ! basically create mydll.c , mydll.spec build winelib dll command: winegcc -m32 -shared -o mydll.dll mydll.c mydll.spec now have mydll.dll.so , want override mydll.dll (both @ same place) should ? try rename mydll.dll got page fault when function called ! tried configure override winecfg or set environment variables winedllpath. don't understand how proceed. how load library in windows executable hinstance dllhandle; char str[255]; typedef int(*tfp)(char * const); dllhandle = loadlibrary("mylib.dll"); tfp fp = (tfp)getprocaddress(dllhandle, "myfunc"); fp(str); freelibrary(dllhandle); mydll.spec @ stdcall myfunc(str) mydll.c #include <windef.h> int winapi myfunc(char * str) { strcpy(str, "myfunc winelib dll"); return 0; } use winedebug=+module debug dll loading p

perl - Shell command on each line of file -

i trying write perl script following: 1. open file which, in each line, contains location of multiple files (say file a, file b) 2. egrep on each of these files egrep "module|input|output" 3. store output of egrep same file name a, b etc in different directory) there more constraints on egrep, can add them later. my question how do steps 2 , 3? in, execute shell command on each line of file opened perl script. , file location be, example, design/rtl/name.v , want result of egrep stored in design/fake/name.v in shell (bash) make directory results , list files 1 line in file "list" , type straight in @ bash prompt for in `cat list`;do egrep "string" $i > result/grep${i}; done here similar in perl. error behaviour nicer, might tiny bit faster: real advantage behaviours added easier. save file , run "perl script list foo" script filename of script, list filename of list of files , foo pattern being searched for #!/us

java - How can I put Jbuttons into arraylist with considering their name? -

i have code , want put buttons in page in arraylist considering name if name example btn_2 should second element of list. gives error , says cannot cast field jbutton since list type jbutton not field.his not code of them code consist of ading panel adding button panel labels. getcontentpane().setforeground(color.dark_gray); getcontentpane().setlocation(-405, -87); setresizable(false); setdefaultcloseoperation(jframe.exit_on_close); getcontentpane().setlayout(null); panelpod1 = new jpanel(); panelpod1.setbounds(65, 13, 353, 313); panelpod1.setborder(new bevelborder(bevelborder.raised, color.dark_gray, null, null, null)); getcontentpane().add(panelpod1); panelpod1.setlayout(null); jpanel panel = new jpanel(); panel.setborder(new softbevelborder(bevelborder.lowered, color.dark_gray, null, null, null)); panel.setbounds(10, 11, 59, 59); panelpod1.add(panel); panel.setlayout(null); btn_1 = new jbutton(); btn_1.settext(""); btn_1.setenabled(false); btn_1.setborder(new roun

string - Counting how many times certain words show up in a text file in C++ -

i trying make program 2 different text files. 1 of them contains actual text want analyze , other contains list of words. program supposed check when word list shows in text , count that. here (non working) code have far: #include <iostream> #include <string> #include <fstream> using namespace std; int main () { string word1; string word2; int listhits = 0; ifstream data1 ("text.txt"); if ( ! data1 ) { cout << "could not open file: " << "text.txt" << endl; exit ( exit_failure ); } ifstream data2 ("list.txt"); if ( ! data2 ) { cout << "could not open file: " << "list.txt" << endl; exit ( exit_failure ); } while ( data1 >> word1 ) { while ( data2 >> word2 ) { if ( word1 == word2 ) { listhits++; } } } cout << "your text

Spring 3.1 Web services working example -

please suggest me useful links have step step spring web services sample examples implementation. need install plugin in spring tool suite. as said @evandongen, spring 3.1 features rest web services. soap web services can implemented spring-ws, in version 2.1.3. the spring-ws manual has tutorial shows step-by-step how implement soap web service.

html - Get the div of current scroll offset of UIWebView -

i have 2 different html files, 2 different uiwebviews & uisegmentcontrol . on segmentchanged , had displayed webview loading html file. both html files contains common sections section content changed. want implement functionality that, when user reads section 1.1 of first webview & clicks segment loading second webview , second webview needs scroll upto section 1.1 reads in first webview , viceversa. there n number of sections. used following javacript needs parameter of current div id . on scroll , how can current visible div id . had given id each div . function pointinview(id) { var divid = document.getelementbyid(id); divid.scrollintoview(true); return false; } anyone please me. i think jquery might able come rescue. could use jquery, since it's cross-browser compatible? http://stackoverflow.com/questions/5353934/check-if-element-is-visible-on-screen check out answer form benm

android - PageCurl animations on ViewPager transitions? -

here's demo of page curl animation looks like: http://www.youtube.com/watch?v=avzhn_o45sg there couple of page curl animation libraries: https://github.com/harism/android_page_curl https://github.com/mystictreegames/android-page-curl they meant work bitmap drawables , not viewgroups. if wondering if has come similar page curl transition viewpagers. not straight way..but, how creating bitmap of view group getdrawingcache() method , pass bitmap library.

directx - SlimDX - Low Resolution in Win7 + DX9 on AMD 6350 -

i implemented visualisation few months ago on old xp machine slimdx , old geforce. worked perfectly. startet stuff on new computer: windows7 intel i7 amd hd6350 it's still directx 9 device. resolution low!!! tested screenshot in photoshop. pixel in visualisation consists of 4 pixels on screen. control draw has 1000 x 1000 pixels, slimdx stretch 500x500 pixel control... antialiasing , stuff on , off - nothing happened. anyone idea? :-/ solution found!!! since win7 backbuffer size has set manually!

android - What does this expression mean : "R.string.gcm_registered"? -

i trying enable push notifications on application. i have client sample code , trying of code implement on application. of have implemented push notifications on apps sure familiar class gcmintentservice . so copying class on project , configure manifest correctly(or think do) errors in file. the errors in expressions r.string."something" for example errors in : r.string.gcm_registered r.string.gcm_message r.string.gcm_deleted r.string.gcm_error r.string.gcm_recoverable_error r.drawable.ic_stat_gcm the error gcm cannot resolved or not field. but expression?! class or something? is on manifest havent configured correctly? it strings, in example app you're using, in /res/values/strings.xml you put strings in there have localized place put user visible strings in, have 1. 1 place find strings, if ever want change and/or re-use 2. easy access translation putting translations in per example /res/values-de/strings.xml look file in whatever

Post in Google+ stream is not showing up in user's stream using google-api-PHP-client -

i'm trying post in user's google+ stream, , i'm trying using google-api php client. until now, i've been able of configure test environment using latest google-api php client , example script (see 401 unauthorized access when posting google+ moments php client more information). looks posts, because returns array answer, nothing shows in user stream. the answer array is: array ( [kind] => plus#moment [type] => http://schemas.google.com/addactivity [target] => array ( [kind] => plus#itemscope [url] => https://developers.google.com/+/plugins/snippet/examples/thing ) [result] => array ( [kind] => plus#itemscope ) [id] => xxxxxxxxx ) which looks correct. know why happens , how solve it? thank you! app activities not render in user's stream instead render in app activities section of google+ here: https://plus.google.com/apps/ to prevent spam in stream, user mu

extjs4 - How to change header template in extjs 4 grid panel -

Image
i want change default header template of grid. not know config or property set. tried "rendertpl" , "tpl" , "metarowtpl" these property related row in grid, want change header. any example or link great. like above image, want header/row/column-header in between text come database (and filter information). you change header text following command yourgrid.getview().getheaderatindex(columnindex).settext('header text'); http://jsfiddle.net/alexrom7/yntun/3/

android - "You have already authorized" Facebook page -

yes, facing same problem,i'm getting page message"you have authorized" when press "sign in via facebook" in mjyandroid app, works fine other users, me(i facing issue). can u tell me , how fix it. as of today, looks -every- of our users have same behavior on our ios apps. started few users mentioning change in behavior larger (all?) users seeing this. apparently, new fb app authorization workflow , seem affect apps go through inline login form (i.e. older fb sdk) or goes through safari browser (again... experience on ios side). please log defect on fb bug tracking site.

Access reports based on sorted query? -

when creating access report based on query, when report needs sorted, 1 has define sort keys , order in report itself, using sorting , grouping icon. question whether defining sort order in underlying query has impact interms of performance, or these ignored access report ? for extremely large result sets sort on query might slow things down, best avoid if can. have not seen mention of access report "ignoring" order clause on underlying query. suppose it's possible , sort of doubt it....

node.js - Converting a mongo stored date back into milliseconds since Unix epoch when loaded? -

i using mongoose & node.js webserver. as part of 1 of document schemas, have 'timestamp' field. line in schema is: timestamp: { type: date, default: date.now } this works fine, , allows me retrieve documents based on timestamp, however, saves isodate format described here: http://docs.mongodb.org/manual/core/document/#date , this: "timestamp":"2013-04-04t19:31:38.514z" i don't mind this, send client is. means have use date.parse() @ client end before can comparative operations it. is there way either store date integer, or automatically convert 1 when it's retrieved? is there reason should keep how is, , deal @ client end? thanks in advance. you can add numerical milliseconds version of timestamp virtual attribute on schema: schema.virtual('timestamp_ms').get(function() { return this.timestamp.gettime(); }); then can enable virtual field's inclusion in toobject calls on model instances via option o

php - Foreach sends email for every loop -

This summary is not available. Please click here to view the post.

ios - How can i send JavaPNSpayloads using PushMagic token -

Image
hi implementing ios mdm using javapns. steps performed now. 1)i installed xxx.mobileconfig file on ios device. 2)i using javapns sending notifications. 3)i got pushmagic token ios device.i got 200 response. 4)i using https:// checkin url. using ipcu generating mobileconfig files. 5)my intension install custom payload disable camera,disable youtube ..etc. 6)i using restriction payload .i sending push notification ios device cannot responding server... following issue seems issue can 1 guide me. http://code.google.com/p/javapns/issues/detail?id=103 any advice appreciated. try following download , install iphone configuration utility . connect device , open console tab send command server device , see logs (see image below) if can see traces of mdm in logs such starting, polling etc, means device has received apns message , trying connect mdm server commands. if in console find error, need further investigate. if don't see traces of mdm in logs, there

php - Connecting to SQL Server 2012 on IIS8 with PHP_SQLSRV -

this project, doesn't require extreme levels of caution/security - i'd working , improve there. how can php connect sql server 2012 what have done successfully: enabled mixed authentication on sql server 2012 established account using sql authentication set fastcgi on iis , configured php.ini .php scripts in web root execute successfully i can use ssms connect locally sql database using credentials (sql authentication) created the problem: i cannot use php script connect local sql database. what have considered, not understand enough diagnose: that http connections iis impersonating iusr, has permissions read/execute php scripts in web root, may not have permission connect server? that reason connection dialogue ineffective here connect script: $servername = 'localhost'; $connectioninfo = array( 'database'=>'database', 'encrypt'=>'1', 'uid'=>'user', 'pwd&

opengraph - sharethis not working properly on sharing link for facebook -

i've used sharthis plugin sharing news link website. there problem in sharing link facebook it's showing image, title, description of news. i've googled , added open graph tags ( og:url, og:title, og:description, og:image ) , defined namespace still working. i've tested facebook debugger tools( https://developers.facebook.com/tools/debug ), didn't error message still doesn't sharing properly. there problem site content, because news in unicode , i've used unicode slug in url well. please me. i guess not still problem now, facebook open graph object debugger can useful when having problems open graph metadata.

Issue in clicking on the browse button with selenium in IE -

i clicking on browse button in ie using selenium webdriver code in upload file utility reading co-ordinates of browse text. whlie code works fine in machines in ie , firefox both, in yet machine same code working firefoxx browse button becomes unclickable in ie. checked settings in internet options, looks alike in both machines. please let know if faced such issue , resolution work. if there other way upload file in app avoiding "browser" button method, preferred. people use apache httpcomponents post upload servlet "browse" button refers to. far preferred method rather using webdriver. problem browse button opens native os controls ( in cases) , way can control using sikuli api click on elements based on finding them matching screenshots. also, if use sikuli, can't run multiple browser tests on same machine since each test block screen comparisons of test , rule out of using remotewebdriver.

c++ - Create a fixed size std::vector and write to the elements -

in c++ wish allocate fixed-size (but size determined @ runtime) std::vector write elements in vector. code using: int b = 30; const std::vector<int> test(b); int &a = test[3]; however, gives me compiler (msvc 2010 pro) error: error c2440: 'initializing' : cannot convert 'const int' 'int &'. conversion loses qualifiers. my understanding of const makes of member variables of class constant. example, following works fine: class myvec { public: myvec(int num) : ptr_m(new int[num]) {}; ~myvec() { delete ptr_m; } void resize(int num) { delete ptr_m; ptr_m = new int[num]; } int & operator[] (int i) const { return ptr_m[i]; } int *ptr_m; }; const myvec test(30); int &a = test[3]; // fine, desired test.resize(10); // error here, expected it therefore seem std::vector propagates const-ness of container elements of vector, seems odd because if had wanted elements const have used std::vector<const int> . t

sql - Combining three SELECT statements together -

i need join these 3 select statements together; possible? need 1 table result. /*soutezni zapasy*/ select jmeno, count(case when ucast = 'true' 1 end) pocet_zapasu, sum(case when branky>0 branky end) branek hraci inner join ucast_zapas on ucast_zapas.id_hrace_zapas=hraci.idhrace inner join zapas on zapas.id_zapas=ucast_zapas.id_zapasu_ucast inner join kategorie on kategorie.idkategorie=zapas.kategorie_zapas (kategorie.idkategorie = 1) , zapas_datum >= '1/1/2013' , zapas_datum < '9/1/2014' and(zapas.druh=1) group jmeno; /*pratelske zapasy*/ select jmeno, count(case when ucast = 'true' 1 end) pocet_zapasu, sum(case when branky>0 branky end) branek hraci inner join ucast_zapas on ucast_zapas.id_hrace_zapas=hraci.idhrace inner join zapas on zapas.id_zapas=ucast_zapas.id_zapasu_ucast inner join kategorie on kategorie.idkategorie=zapas.kategorie_zapas (kategorie.idkategorie = 1) , zapas_datum >= '1/1/2013

android - Download file to external public storage without knowing the filename -

my http-server allows downloading files 'dynamic' url: e.g. http://myserver.com/query?id=12345 give me my_song.mp3. filename indicated in content-disposition header. downloading kind of file android downloadmanager works fine want able control file being saved to. normal way call downloadmanager.request r = new downloadmanager.request(uri); r.setdestinationinexternalpublicdir(string dirtype, string subpath); unfortunately requires know filename front don't know. tried calling above function null subpath not work...

functionality testing of controller in ruby on rails -

i have product controller in have method homepage , _homepage.html.erb file in views. how test method assert should response success. created productcontrllertest.rb in test/functional , wrote below code require 'test_helper' class productcontrollertest < actioncontroller::testcase test "should homepage" :homepage assert_response :success end end and have routes.rb file "product/homepage" when run test command bundle exec rake test:functionals getting error. error nomethoderror: undefined method `authenticate' nil:nilclass please me fix error. require 'test_helper' class productcontrollertest < actioncontroller::testcase test "should homepage" 'homepage/1' assert_response :success end end

java - Remove icon from launcher -

it popular problem , no 1 know how resolve it... for example: <application android:allowbackup="true" android:icon="@drawable/add" android:theme="@style/customtheme" android:showasaction="ifroom|withtext"> and need hide android:icon or wanna remove it <application android:allowbackup="true" android:theme="@style/customtheme" android:showasaction="ifroom|withtext"> but in case have default android icon -_- possible permanent remove icon? this can remove launcher icon after next reboot: packagemanager pm = getpackagemanager(); pm.setcomponentenabledsetting(getcomponentname(), packagemanager.component_enabled_state_disabled, packagemanager.dont_kill_app); also link can too: hide application launcher icon in title bar when activity starts in android

java - Regex with two patterns -

i have requirement in want 2 different items form 1 long string. have got below program in required items when group(1) , group(6). want in group(1) , group(2). import java.util.regex.matcher; import java.util.regex.pattern; public class regexexample { public static void main(string args[]) { string somepattern = "((123|456)-(0|1)-((\\d-?){8})-\\d{1})/(\\d{2})"; string str = "/somethingwaste/123-0-1234-5678-9/10"; matcher p = pattern.compile(somepattern).matcher(str); while (p.find()) { system.out.println(p.group(1)); system.out.println(p.group(6)); } any pointers directions appriciated. thanks this should it string somepattern = "((?:123|456)-[01]-(?:\\d-?){8}-\\d)/(\\d{2})"; the ?: makes () non-capturing.

java - Is there any benefit in implementing a interface in a subclass even though the superclass implements the same interface -

when seeing declaration of arraylist class arraylist<e> extends abstractlist<e> implements list<e>, randomaccess, cloneable, java.io.serializable which implements list interface eventhough arraylist's superclass abstractlist implements same list interface. abstract class abstractlist<e> extends abstractcollection<e> implements list<e> similar declarations can found on hashmap, linkedhashmap declarations also. in declaration of linkedhashmap, implements map interface , not other interfaces implemented superclass hashmap. so there might benefits of having such declarations. there no functional benefits declaring them again, not affect behavior in way. i guess it's added make clearer interfaces implemented.

m2eclipse - apt maven plugin fail to generate Q classes -

i fixing legacy project uses querydsl apt. reason apt-maven-plugin started fail. workaround found use alter ego maven-processor-plugin . i have reinstalled maven, eclipse , m2e not success. maven-apt-plugin unable create q classes under /target/generated-sources/metamodel. edit: adding debug maven [debug] configuring mojo com.mysema.maven:apt-maven-plugin:1.0.8:process pl ugin realm classrealm[plugin>com.mysema.maven:apt-maven-plugin:1.0.8, parent: su n.misc.launcher$appclassloader@6d9bf996] [debug] configuring mojo 'com.mysema.maven:apt-maven-plugin:1.0.8:process' basic configurator --> [debug] (s) logonlyonerror = true [debug] (s) outputdirectory = c:\dev\myproject\mainstuff\mainstuff-jpa\target\generate d-sources\metamodel [debug] (s) pluginartifacts = [com.mysema.maven:apt-maven-plugin:maven-plugin: 1.0.8:, org.sonatype.plexus:plexus-build-api:jar:0.0.7:compile, org.codehaus.ple xus:plexus-utils:jar:1.5.8:compile, backport-util-concurrent:backport-uti

c# - Printing from windows service on windows 8 fails -

i have windows service application written in c# .net. application used generate report pdf printing document local software printer generates pdfs. works on windows xp , windows 7. unfortunately found on windows 8 fails. found out printing (even physical) printer on windows 8 fails when print service. missing in program work? i'm printing way: flowdocument document = mydocument; var source = document idocumentpaginatorsource; var documentpaginator = source.documentpaginator; using (var printserver = new localprintserver()) { printqueue queue = printserver.getprintqueue(printername); xpsdocumentwriter docwriter = printqueue.createxpsdocumentwriter(queue); // print ticket - approach 1 // printticket printticket = queue.defaultprintticket.clone(); // print ticket - approach 2 var printticket = new printticket { pageorientation = pageorientation.landscape, pagemediasize = new pagemediasize(pagemediasizename.isoa4), // set size of me