Posts

Showing posts from May, 2015

android - DevicePolicyManager, locknow when gcm message received -

i trying remotely lock phone when gcm push notification keyword arrives. inside gcmintentservice class, within onhandleintent have included message = extras.getstring("message"); if(message.equals("lock")){ gcmaction(message); } else{ sendnotification("message: " + extras.getstring("message")); log.i(tag, "message: " + extras.tostring()); } so if message arrives saying lock, should go gcmaction method. otherwise go notification method. private void gcmaction(string string) { mdpm = (devicepolicymanager)getsystemservice(context.device_policy_service); //lock action mdpm.resetpassword(password, devicepolicymanager.reset_password_require_entry); mdpm.locknow(); } sendnotification correctly showing notfications nothing happens when send "lock" ...

java - How to create an interface to get info from a Fragment to an Android Activity? -

over past days i've desperately been trying build android app simple fragment (which use twice). want pass contents of fragments' edittext-boxes new activity. can't figure out how contents fragments. have far this: i've got edit_text_fragment.xml : <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <edittext android:id="@+id/my_edit_text" android:layout_width="fill_parent" android:layout_height="wrap_content" android:hint="my hint" /> </linearlayout> and corresponding myedittextfragment.java : public class myedittextfragment extends fragment { @override public view oncreateview(layoutinflater inflater, viewgroup cont

jquery - How to submit a form with ajax and php -

i trying add change password function on site. decided try using ajax site not have update itself. have 1 problem. when submit form php file nothing happends success ajax file. , password not change in sql db. this html file. <div class="boxpw"> <div class="boxinner"> <a href="#"><img class="closebox" style="float: right;" src="images2/zoom/closebox.png" /></a> <h2>endre passord ditt</h2> <div id="linebreak" style="margin-top: -19px; width: 70%;"></div> <h4>skriv inn et nytt passord <?php echo $fname.' '.$lname.' ';?> vi anbefaler @ du oppretter et unikt passord Рet du ikke bruker p̴ noen andre nettsteder. <h4>

Minimum amount of change c++ -

i need give minimum amount of change possible.i input number of cases,each case had number of coins(1 not part of them) , number of number want test.then enter different coins , different number test. i dont know why program isnt working.since 1 isnt part of change,i had tweak program little. #include "stdafx.h" #include<iostream> #include<conio.h> #include<functional> #include<numeric> #include<algorithm> #include<vector> using namespace std; int main() { int n,i; cin>>n; int f=n,c,m; int flag=0; int m1; int coins[100]; vector <int>storage(100,0); vector <int> testcases(1000,0); vector <int> answers(1000,-1); while(n>0) { cin>>c; cin>>m; for(i=1;i<=c;i++) { cin>>coins[i]; } for(i=1;i<=c;i++) { cin>>testcases[i]; } m1=*max_element(tes

ios - How to use multiple reusable TableViewCells -

i add multiple reusable uitableviewcells tableview. using code this, won't work, shows first cell. here code: - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { if (indexpath.row == 0) { static nsstring *costumecell1 = @"cell1"; appdetailcell1 *cell1 = [tableview dequeuereusablecellwithidentifier:costumecell1]; if (!cell1) { cell1 = [[appdetailcell1 alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:costumecell1]; } return cell1; } if (indexpath.row == 1) { static nsstring *costumecell2 = @"cell2"; appdetailcell2 *cell2 = [tableview dequeuereusablecellwithidentifier:costumecell2]; if (!cell2) { cell2 = [[appdetailcell2 alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:costumecell2]; } return cell2; } else { return nil; } } i

java - EclipseLink and H2 -

i trying use eclipselink jpa provider h2 dbms in eclipse ide. when create new jpa project , fill data (url="jdbc:h2:~/test",username="user",password="") connection type : resource local (i'm using embedded mode) 2 odd things : when try create entities table blank table list i error message near @entity notation saying "catalog user can't resolved entity e1" or "schema user can't resolved entity e1" depending on keeping default value catalog or changing upon project creation user database user name the database contains tables using h2 console in firefox what cause of these problems , how can solve , have page or book can persistence.xml file (other oracle official web site)? eclipselink doesn't create database tables you, unless explicitely tell so. the way described in the documentation eclipselink can used automatically generate tables , database schema persistence unit. done throug

multiprocessing - C fork - how to wait for all children before starting workload? -

i trying fork() create multiple processes of same work. need of them created first, , @ same time start doing work. is, want of processes wait of other ones created, , once ready, start doing work @ same exact time. is possible? thanks. the simplest approach using signals, note there no way guarantee processes indeed run in parallel. that's os decide.

objective c - Xcode 5 constantly crashing. Looking for root cause. -

i know site more coding questions, have been having problem game crashing 2 weeks now, , apple hasn't begun helpful in solving issue or identifying be. hoping maybe has experienced similar , @ least me pointed in right direction. for week had problem xcode crashing every time accessed current file (gameboard.m) in game. file had existed in game months , never caused crash , never did until few days after installed xcode 5. whenever working, , click on gameboard.m, would, increasing frequency, crash xcode. when looking @ activity monitor, free ram go 5gigs 10 mbs, , have force-quit xcode. after gameboard.m crash xcode, crash xcode upon opening every time after that. found temporary fix issue duplicating file, going , deleting gameboard.m file, copy , pasting previous version , re-importing it. sometimes click on gameboard.m , open fine, if press cmd+opt+shift+left collapse methods, crash xcode. every time xcode crashes same thing, ram goes 0, freezes until force-quitted. a

c++ - How to make a program declare variable number of indefinite size arrays -

this might sound crazy wondering if possible make program declare n number of arrays of type array[] in loop using c/c++. example, sample pseudo-code: input int _n_ run loop _n_ times such that: declare _array1[]_ declare _array2[]_ . . declare _array'n'[]_ so problem here two-fold: - declare variable length arrays - declare variable number (i.e. n number of) such arrays. the truth table: task / language | c | c++ -------------------------------+-----------------------+------------------------ declare variable length arrays | use vlas | not possible without | int arr[n]; | non-standard extensions | | use std::vector<t> -------------------------------+---------------------+-------------------------- declare variable number | not possible | not possible use (i.e. n number of) such arrays | use in

asp.net - Get first cell data in child grid of kendo hierachy grid -

i m using kendo hierarchy grid. in child grid put "edit" button. need child row first column data (id) when click edit button. my detailinit function , clickbfunction here. function detailinit(e) { var _po_sectionid =e.data.sectionid; $("<div/>").appendto(e.detailcell).kendogrid({ datasource: { transport: { read: _postionsbysectionurl + _po_sectionid }, schema: { data: "data", total: "count" }, }, scrollable: false, sortable: true, pageable: true, { field: "containerid", title: "possition id",hidden:true }, { field: "containername", title: "containername&q

c# - Connect Windows Store Apps to SQL Server Database Using WCF -

hello trying connect windows store app sql server database using wcf middle-ware. able successfully. not able insert valuses database. please can me this? here code: this mainpage.xaml <page x:class="windowsstoretosql.mainpage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:windowsstoretosql" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:ignorable="d"> <grid background="{staticresource applicationpagebackgroundthemebrush}" rendertransformorigin="0.508,0.484"> <textbox horizontalalignment="left" name="idtextbox" textwrapping="wrap" text="" verticalalignment="top" margin="108,162,0,0" width="

objective c - OS X Status Bar Application with a title in two lines -

Image
i'm old ios developer , want make simple os x status bar application. need put title @ nsstatusitem should in 2 lines, istatpro network feature. how should add it? here simple example. example shows 2 lines 2 simple blinking lights. it uses nsview (custom view) 2 nstextfields , 2 nsimagewells inside of it. the red , green light images added project , set image wells in ib. .m // // appdelegate.m // drawing strings // // created mark hunte on 07/10/2013. // copyright (c) 2013 mark hunte. rights reserved. // #import "appdelegate.h" @implementation appdelegate nsstatusitem *statusitem; -(void)awakefromnib{ //-- set attributed text lines. gives more control on text if want it. nsmutableparagraphstyle *paragraphstyle = [[nsmutableparagraphstyle alloc] init]; //--set height of lines paragraphstyle.maximumlineheight = 12.f; //-- text nstextfield 1 nsattributedstring *attributedstring = [[nsattributedstring allo

Looping through JSON array with jQuery -

i trying loop through simple json array , display contents jquery. json data is: { "cards":[ { "title":"cat", "spanishword":"gato" }, { "title":"dog", "spanishword":"perro" } ] } here jquery using: var jqxhr = $.getjson("http://www.myurl.com/cards.js", function (data) { $.each(data.cards, function (i, item) { $(".list").append("<li id='" + cards[i].title + "'>" + cards[i].title + cards[i].spanishword + "</li>"); }); }); i pretty problem in each statement can't figure out wrong. the problem inside loop, use cards[i] instead of data.cards[i] . you use item instead of data.cards[i] .

c++ - Makefile for compiling different "modules" which can include each other -

we have project module structure this: - project - mod1 - mod1.cpp - mod1.h - main.cpp - mod2 - mod2.cpp - mod2.h - main.cpp - more modules the main.cpp file in each module instantiates , tests module. 1 module can include , use module. example, module 1 can include module 2 , other modules. we want create makefile compiles , includes correct modules , main.cpp file. if write "make module2" makefile compile mod2.cpp, main.cpp (in module 2) , include mod2.h. if write "make module1" makefile compile mod2.cpp, mod1.cpp main.cpp (in module 1) , include mod1.h , mod2.h. my experience makefiles modest, , i've used several days on without success. making generic preferable adding new module not require major changes makefile. the closest solution got this: .phony: clean flags=-std=c++11 -g -i"$(systemc_path)/include" -i"$(systemc_path)" -l"$(systemc_path)/lib-linux64" -lsystemc $(addprefix -i,

linq to sql - Copy SQL Server Express table to SQL Server CE table for vs2012 -

i using visual studio 2012 , trying import or copy table sql server 2008 express database local db using sql server compact edition vs2012. i have found there no management support in sql server management studio 2012 / 20008 visual studio 2012 sql server ce local db. they management interface can use visual studio 2012 professional edition.. can access both db's with. but when try copy table vs2012 using following sql ce sql new query command.. insert sqlcedbname.dbo.testdata select * sql2008dbname.dbo.testdata (both tables same name) it not give me data -- , acts can't find database name ignores them , thinks want copy ce table 'cetable' 'cetable' both tables in sql server 2008 r2 , vs2012 ce exact structure , name.. ce table not have data in it. also -- (vs2012 ce support) -- not read sql script file created in 2008 ssms either. use sql server compact toolbox add-in, allows script single server table w data - right click

Delphi - mouse move simulation -

how can simulate mouse moves (from point x,y point a,b), ideally 10 pixels / second? found setcursorpos function, function cannot move cursor correctly. goal move cursor on twebbrowser component , read hints ocr (and find text i'm looking for). ps: i'm using delphi 7.

php - mysqli parameterised queries that use arrays -

how can use array sql query , loop through results? here i've got, i'm not sure how should use implode variables in query <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <titleard log</title> <link rel="stylesheet" type="text/css" media="all" href="jsdatepick_ltr.min.css" /> <script type="text/javascript" src="jsdatepick.min.1.3.js"></script> <script type="text/javascript"> window.onload = function() { new jsdatepick({ usemode:2, target:"inputfield", dateformat:"%d-%m-%y" }); new jsdatepick({ usemode:2, target:"inputfield2", dateformat:"%d-%m-%y" }); }; </script> </head> <body> <form action="#" method="post"> <input type="checkbox" name="driver[]" value="julia">

Get a special type of child in an xml document with PHP -

i'm looking way special type of child out of xml file php. xml: <notify type="post" name="max" /> i want grab name out of there. code: `$sender = $sender = $node->getchild('notify'); $sender = $sender->getchild('name'); $sender = $sender->getdata(); but expected isn't working way. in advance help you can use xpath expression job done. sql query xml. $results = $xml->xpath("//notify[@type='post']/@name"); assuming xml in $xml , expression reads like select notify nodes, type-attribute post, give name-attribute. $results will array, , code example made simplexml . can use same xpath-expression dom though. here's complete code: $x = <<<xml <root> <notify type="post" name="max" /> <notify type="get" name="lisa" /> <notify type="post" name="william" />

qt - Create QMenu class outside of main UI -

first off want mention i'm java background. i'm designing first app in qtcreator, , want add menus it. i want create qmenu widget in separate file, keep main ui window simple , clean. this possible defining qmenu in xml file , including in main .ui file using file(load) method, or similar. however in qt creator can't find how create new file inherits qmenu? what correct way it? i want each components simple , specific. so ui 'main' method entry point, draw main window, , include initial menu item, intend show simple 'welcome' type page having menu item connected data source. i expect menu contents change depending on type of data, (or rather part of program user acting with). intend handle these different menu's in different files related user interaction. thanks in advance. david i assume want use qmenubar represents main menu or qmainwindow. qmenu not embedded in other widgets. this quite possible. create designer fo

android - All inflated items are vanished when screen orientation changes -

please me.. in activity use loop inflate items using layoutinflator service. there textviews in activity. textview values remain unchanged inflated items vanished when change screen orientation.. i know activity recreated again redraw ui match layouts , tried saving instance bundle. helpless. can save these inflated items bundle , restore on restore. one guy told me hide soft keyboard when change orientation. set properties on manifest , hiding keyboard on orientation change event listener. the way can protect app turn off auto orientation. thats not want. in manifest, put android:configchanges = "orientation" activity. prevent activity being destroyed , recreated when rotate screen. note have careful when doing this. if of resources depend on orientation configuration (like if have resource folder called values-land or drawable-port, etc.) these resources must reloaded after configuration change. see documentation here .

php - Comparing dates and times in different fields -

now, i've problem following query: select * table date > curdate() or date = curdate() , time > curtime() it's return rows date > of today need rows date of today time > of current time. you need put related clauses inside parenthesis: select * table date > curdate() or ( date = curdate() , time > curtime() )

floating point - Smallest integer after only integers can be expressed IEEE 754 -

what smallest integer after integers can represented ieee 754 (single/double)? my guess occurs when exponent 254 (11111110b single). that, no matter 1 puts in mantissa number integer. want confirm , equivalence in powers of 2. presuming “after” refers numbers greater magnitude , not later in time, 2 23 32-bit binary floating-point , 2 52 64-bit binary floating-point. (these float , double in common programming language implementations type names.) this because significands of 32-bit , 64-bit formats have 24 , 53 bits, respectively. so, in 32-bit format, if high bit scaled 2 22 exponent, low bit 2 –1 (from 22 –1, inclusive, 24 positions). since significand contains bit scaled non-integer value, complete represented value non-integer. if high bit scaled 2 23 or greater, low bit has value @ least 2 0 . so, if integer less 2 23 , @ 2 23 –1, means high significand bit scaled 2 22 , low bit 2 –1 . indeed, 2 23 –½ representable float . the same reasoning applies do

Implementing AlgorithmM of TAOCP vol 4 fascicle 2 using Haskell -

i have tried implement title says because of lazy evaluation cannot take result: data algorithmm = algorithmm {fm::[int],fa::[int],fj::int,fn::int} m1a :: algorithmm->(io (),algorithmm) m1a (algorithmm m j n) = (return (),algorithmm (2:m) j n) m1b :: algorithmm->(io (),algorithmm) m1b (algorithmm m j n) = (return (),algorithmm m (take n $! repeat 0) j n) m2 algo = (visit false $ fa algo,algo) visit true l =do mapm (\z->putstr $ show z) l putstr "\n" visit false (x:xs) = mapm (\z->putstr $ show z) xs putstr "\n" initn :: algorithmm->(io (),algorithmm) initn (algorithmm m j n) = (return (),algorithmm m j ((length m)-1)) m3 :: algorithmm->(io (),algorithmm) m3 (algorithmm m j n) = (return (),algorithmm m n n) m4 :: algorithmm->(io (),algorithmm) m4 (algorithmm m j n) = if (a !! j) == (m !! j) - 1 m4 (algorithmm m (setajzero j) (j-1) n) else (return (),a

jquery - Using servlets in Struts 2 -

i wonder if using servlets in struts 2.3.4 practice or not? i need place html in specific place in jsp without page refreshing . found 2 ways achieve this: 1.create servlet , use ajax handle post request/response, i.e. : <div id="maindiv"> </div> <script> $(document).ready(function() { $('#div2').click(function() { $.post('testservlet', function(responsetext) { $('#maindiv').html(responsetext); }); }); }); </script> 2. call action using jquery plugin , place generated response in target place in jsp (using well-known sx:submit ). problem not know how handle post request/response. jquery submit uses get method. could please tell me solution better? in both cases have access httpservletrespone , printwriter allows writing text/html content result jsp . should use printwriter inside action class or in servlet method? there no

html - My website mess up with browser resize -

below ideal of website http://i44.tinypic.com/jayyhu.jpg but doesn't same in computers. checked browsershots . org , website mess in browsers. mess when resize browser. perhaps it's because don't horizontal scroll on browser resize. please suggest me ways fix it. my website url http://come2chat.x10host.com if doesn't open please refresh window. using free webhost during development period , it's not reliable. i think biggest problem using margins , paddings center content in screen , makes more difficult. instead, create wrapping div , set margin: 0 auto; it. i made small change in page, can check here: http://www.radiogramola.cat/stack/u.html i added 2 div class "wrapper" , css resets. can check code. then, should decide kind of layout want create: fixed : stackoverflow.com, when user resize window, page not change. fluid : wikipedia.org, expands occupying available space , adapts browser size. responsive : css-tri

django - Numpy Runtime Warning causing Apache Workers to freeze in "Sending Reply" state -

Image
recently, tracking down elusive bug in code. came down numpy code computes mean of part of array. np.array(x[x == i]).mean(0) of course, if there no elements in x value of i previous code equivalent calculating mean of empty array. np.array([]).mean(0) this results in value nan . on architectures, results in warning. runtimewarning: invalid value encountered in double_scalars we fixed code , works great now, there part of story bit more troubling. the way bug manifest caused apache processes seize every worker stuck in "sending reply" state. workers caught in "sending reply" not actual worker caused problem, followed after it. no python exceptions raised, memory usage fine, , cpu barely being used. crippled apache until become unresponsive. we use apache, django, mod_wsgi, , numpy among other things. any ideas on why numpy code caused apache seize up? take action prevent in future. see: http://code.google.com/p/modwsgi/wiki/

php - Hyperlinks do not get proper value -

i have php script has infinite loop in it. browser not print first echo statements in loop, not provide proper links hyperlinks. have gone wrong? demo code: <html> <head> <style> img{ height:200px; width:200px; } </style> </head> <body> <?php error_reporting (0); set_time_limit(0);// setting infinite timeout limit. for($i=1; ;$i++) { $to_send = "http://graph.facebook.com/"; $to_send_new = $to_send.$i; $content = file_get_contents($to_send_new); $parsed = json_decode($content); $link = $parsed->link; $link = str_replace("http://www.facebook.com","https://graph.facebook.com",$link); $link .="/picture?width=200&height=200"; if(!$parsed->first_name) goto a; ?> <br> first name: <?php echo $parsed->first_name;?> <

java - Issues while generating Perlin Noise -

Image
i've created function generate 2-dimension array of perlin noise data, starting base noise array of random values between 0 , 1. the base white noise array looks this: from there, use smoothnoise() function interpolate values create looking image (which don't have because doesn't work) the smooth noise function called once every octave. images of data smooth noise function returns follows (octaves lowest highest) after smoothing done image outputted turns black. upload image black there no need. my code is: import java.util.random; public class noise2d { int width; int height; public noise2d(int width, int height){ this.width = width; this.height = height; } public double[][] generatewhitenoise(int width,int height){ random r = new random(0); double[][] whitenoise = new double[width][height]; for(int = 0; i<whitenoise.length; i++){ for(int j = 0; j<whitenoise[0].len

Android Progress Bar style programmatically -

i'm trying instantiate progress bar main activity , add view dynamically. when this, bar: progressbar bar = new progressbar(this, null, android.r.attr.progressbarstylehorizontal); layoutparams params = new layoutparams(layoutparams.match_parent, layoutparams.wrap_content); bar.setlayoutparams(params); bar.setid(mint); linearlayout layout = (linearlayout) findviewbyid(r.id.layout); layout.addview(bar); i started new project includes above code, , progress bar displays correctly. if add following lines above code, screen blank second , shows half full bar. expect see empty bar second , goes 50%. try { thread.sleep(2000); } catch ...{ } bar.setprogress(50); if add code this, however, bar , changes display correctly. button b = new button(this); b.settext("change bar"); b.setonclicklistener(new onclicklistener() { public void onclick(view v) { changeprog(); } }); public void changeprog() {

java - Sorted Arraylist printing out in wrong order -

i have arraylist of temperatures , days. , sorted arraylist using insertion sort method. having when go print out not print out in sorted manner prints out:76, 84, 81, 88, 87. because commented out collections.sort(dailytemps) line? erroring out commented out here code: import java.io.*; import java.util.scanner; import java.util.arrays; public class dailytemperature { //variables private double temperature; private string day; //gettemp & settemp methods public double gettemp() { return temperature; } public void settemp(double newtemp) { temperature = newtemp; } //getday & setday methods public string getday() { return day; } public void setday(string newday) { day = newday; } //constructor public dailytemperature(string day, double temperature) { this.day = day; this.temperature = temperature; } //compareto method used comparable interfac

android - Play Store downloads wrong arm apk -

got weird problem on app we've got in alpha testing on google's play store. it's massive apk file if combine chip architectures (x86, arm...) split 4 separate apks (with individual version numbers per google rules - don't having 30mb apk pushing it). however, while testing, noticed app ran faster when side-loaded (from local pc) when downloaded play store. phone use test samsung note ii , supports armeabi-v7. unfortunately, when connects play store, google seems pick older armeabi apk load on it. latter runs but, without floating point enhancements of v7 code, screen lurches around zombie on gin. anyone know if there additional flags or 'hints' 1 can put in manifest or elsewhere force v7 apk devices support it?

php - How to deal with integer max difference between 32 bit and 64bit servers? -

it takes long time figure out causing malfunctioning website of mine when migrating better hosting subscription. i use 'self-made' uniqueid generator generate must unique uniqueness not random. use communicate between several services, generate reproducible unique 'numbers' files, articles , on. this function have made , never had problems (i think never runs on 64bit system before?) generate unique id. know uniqueness limited (64.000) never lead problem until now. function sugethashcode($s) { $hash=0; $c=(is_string($s))?strlen($s):0; $i=0; while($i<$c) { $hash = (($hash << 5)-$hash)+ord($s{$i++}); //hash = hash & hash; // convert 32bit integer } return ( $hash < 0 )?(($hash*-1)+0xffffffff):$hash; // convert unsigned int } function suuniqueid( $s, $baddlen = false ) { $i = base_convert( sugethashcode( $s ), 10, 32 ); if( $baddlen && is_string($s) ) { $i.=('-'.sugetlz( dechex( strlen($s)*4 ), 3 )); } r

java - Why was hashcode designed to return int -

this question has answer here: why object#hashcode() returns int instead of long 3 answers it seems hashcode returns int. appears limiting factor due intmax. 1 can argue such never have many objects, cause heap overflow etc. if chose double instead of int guarantee larger extent hashcode wont unique distinct objects ? hashcodes don't need unique. that's why hashcodes. use in hashing algorithms. don't need unique keys.

jquery - javascript is saying function undefined -

http://puu.sh/4jtj9.png i have button calls "createurl()", yet of sudden code saying, "createurl() undefined" whenever press button, i'm using cloudflare , maybe that's issue, working fine until updated jquery, keeps telling me function undefined, has happened else? turn off rocket loader in performance settings. clue right here: "type="text/rocketscript"

symfony - twig {% image string %} with concated string -

i have code that {% in 1..25 %} <li class="span4"> {% set screen = '@tfptportfoliobundle/resources/public/images/bekic/screen' ~ ~ '.jpg' %} <a href="#mymodal" class="thumbnail" data-toggle="modal">{% image screen %} <img src="{{ asset_url }}" alt="młody lider innowacji" /> {% endimage %}</a> </li> {% endfor %} but symfony throws error "unexpected token "name" of value "screen"" on lane <a href="#mymodal" class="thumbnail" data-toggle="modal">{% image screen %} how can concat string use asset url? so works: {% in 1..25 %} <li class="span4"> {% set screen = 'bundles/tfptportfolio/images/bekic/screen' ~ ~ '.jpg' %} <a href="#mymodal" class="thumbnail" data-toggle="modal"> <img src="{{ asset(sc

vba - Visual Basic: Increasing integer every 3 clicks -

so question pretty title says: how integer increase 1 every 3 clicks of button? example, let's integer 900. click button1 once, again, again, , on third click integer changes 901. how can accomplished? thanks in advance. use counter 3 times larger behind scene. start @ 2700 instead of 900, , increase value 1 each click. when want display value increases every third click, divide counter three: displayvalue = counter \ 3

bootstrap image thumbnails ribbon on the left stacks over image on the right on narrow screen -

i creating image viewer. it's layout follows http://bootply.com/85916 on left (red background) image thumbnails stacked vertically (span2 min-width) on right (green background) image (span10) th problem on 1024 pixel screen width image stacks below thumbnails. i think need tweak, or use plain layout without bootstrap don't know how. for change span10 span9 javascript if window size less 1175

javascript - Palindrome program - unexpected identifier error -

i trying write js program print largest palindrome between 1 , 1000 (929). getting uncaught syntaxerror: unexpected identifier on line 4 of code: var num = 1; (var i=0;i<=1000;i++) { if == reverse(i) && isprime(i) num = i; console.log(num); } document.write(num); function reverse(s) { var o = ''; (var = s.length - 1; >= 0; i--) o += s[i]; return o; } function isprime(number) { var start = 2; while (start <= math.sqrt(number)) { if (number % start++ < 1) return false; } return number<=1 ? false : true; } what uncaught syntaxerror: unexpected identifier ? , how fix bug? your if statement missing parenthesis () , block identifiers {} . the syntax javascript if statement follows: if (condition) { // } else { // else } so, change if code above , should good!

python - sqlalchemy - reflecting tables and columns with spaces -

how can use sqlalchemy on database column names (and table names) have spaces in them? db.auth_stuff.filter("db.auth_stuff.first name"=='joe') can't work. rather manually define when doing reflections want put lambda x: x.replace(' ','_') between existing table names being read db, , being used in models. (it might useful create general function rename table names won't work python - reserved words etc.) is there easy/clean way of doing this? i think need define own mapper class? https://groups.google.com/forum/#!msg/sqlalchemy/pe1zfblq56w/erpcn1yysjgj or use sort of __mapper_args__ parameter - http://docs.sqlalchemy.org/en/rel_0_8/orm/mapper_config.html#naming-all-columns-with-a-prefix ideally: class newbase(base): __mapper_args__ = { 'column_rename_function' : lambda x: x.replace(' ','_') } class user(newbase): __table__ = "user table" } you can using re

python - 2.2GB JSON file parses inconsistently -

i trying decode large utf-8 json file (2.2 gb). load file so: f = codecs.open('output.json', encoding='utf-8') data = f.read() if try of: json.load , json.loads or json.jsondecoder().raw_decode error: --------------------------------------------------------------------------- valueerror traceback (most recent call last) <ipython-input-40-fc2255017b19> in <module>() ----> 1 j = jd.decode(data) /usr/lib/python2.7/json/decoder.pyc in decode(self, s, _w) 367 end = _w(s, end).end() 368 if end != len(s): --> 369 raise valueerror(errmsg("extra data", s, end, len(s))) 370 return obj 371 valueerror: data: line 1 column -2065998994 - line 1 column 2228968302 (char -2065998994 - 2228968302) uname -m shows x86_64 , > python -c 'import sys;print("%x" % sys.maxsize, sys.maxsize > 2**32)' ('7fffffffffffffff', true)`

if statement - VBA 2012 - Need to return an error when a user enters text instead of a numbers -

Image
i taking vba class , stuck on problem. cannot use masked text box, solve problem. instead professor wants me learn code, can imagine? all kidding aside, user needs enter gas price text box, hit calculate receive total cost of trip. there more interface spare details. if user enters else number positive number 1 decimal place, should return error. have figured out 0 or 0000 negative number such -3.45. have text or special characters give me error 34.56.12.45. never know, user may feel need type in ip address. key assignment catch probable user errors. here i've written calculation catch errors. have tried try/catch statements well. nothing worked got first 2 parts of if statement work yet failing on last if part until gets calculation. private sub btncalc_click(sender object, e eventargs) handles btncalc.click dim mileage decimal dim miles decimal dim gasprice decimal dim cost decimal if cdec(txtbxgasprice.text) = 0 messagebox

Is it possible to combine Doxygen commands? -

\todo \image html clone.png the intent here place image inside todo appears when put 1 tag after another, tag ignored. there way this? i've tried more \image , appears case 2 tags use in succession. there many ways images documentation. maybe try html , might not break \todo command. \todo <img src=clone.png> you can create alias in setup file makes easy , clean include image. i have found commands seem end other commands. note not commands end "\todo" command. font commands such \c in example \arg not end command. http://www.stack.nl/~dimitri/doxygen/manual/commands.html#cmdarg

ios - FBRequestConnection no respond -

i'm making "fbrequestconnection" friends play game... when update sdk of facebook last one, stop working. because working before. i have no respond, no success, no error. ideas? nsstring *query = @"select uid user uid in (select uid2 friend uid1 = me()) , is_app_user = 1"; // set query parameter nsdictionary *queryparam = [nsdictionary dictionarywithobjectsandkeys:query, @"q", nil]; // make api request uses fql [fbrequestconnection startwithgraphpath:@"/fql" parameters:queryparam httpmethod:@"get" completionhandler:^(fbrequestconnection *connection, id result, nserror *error) { if (error) { [self debug:[nsstring stringwi

svg - How to append a text element with inline tspan children? -

starting dom contains like <svg id="svg0" width="600" height="300" xmlns="http://www.w3.org/2000/svg" version="1.1"> </svg> ...i want programmatically modify element in d3.select("#svg0") end with <svg id="svg0" width="600" height="300" xmlns="http://www.w3.org/2000/svg" version="1.1"> <text x="20" y="20"> lorem ipsum <tspan style="alignment-baseline:text-before-edge">dolor</tspan> sit amet</text> </svg> this far can get: var $svg = d3.select("#svg0"); $svg.append("text").text("lorem ipsum ") .attr({x:"20", y:"20"}); it looks though rest should easy, i've spent last 2 hours trying "obvious" things finish without success. 1 what 1 have finish task described above? 1 i've tried far many things

windows 7 - Use batch file to launch ssdeep with file arguments -

i attempting use looping batch file launch cmd app ssdeep , pass file argument it, keep ssdeep window open copy chunk of output clipboard have following code: @echo off :start set /p filetohash= file fuzzy hash? start c:\users\josh\desktop\ssdeep-2.10\ssdeep-2.10\ssdeep.exe %filetohash% pause goto start this allows me run batch file, can drag , drop file hash cmd window. upon hitting return, ssdeep cmd window appears moment takes hash file, closes. leaves me 1st window generated batch file, requesting key press. i want have 2nd cmd window stay open can copy hash out. similar pause used in batch file, need apply 2nd cmd window created. i'm not sure how search information. have searched info on batch files. used these resources far: https://superuser.com/questions/582095/how-to-create-a-batch-file-that-will-run-cmd-and-a-exe-with-parameters and batch files : how leave console window open thanks in advance, ptw-105 use /b switch start command - se