Posts

Showing posts from July, 2012

php - Showing Featured Item From the Database -

i have database table below. id, bungalow_name, type, address, featured a bungalow can featured in home page. if bungalow featured, featured column has value 1 . have 50 bungalows in tables , 5-7 bungalows featured @ given time. let's assume featured bungalow names below. bungalow 1, bungalow 2, bungalow 3, .........., bungalow 6 what i'm trying show featured bungalow in home page each day. , want loop below below each month. given don't want show bungalow randomly each page load. want show per day 1 bungalow basis. today -> bungalow 1 tomorrow -> bungalow 2 day after tomorrow -> bungalow 3 ... after bungalow 6, bungalow 1 shown on next day. how can it? possible sql/php? you use mysql query: select * bungalows id = ( select b1.id bungalows b1 left join bungalows b2 on b1.id>b2.id , b2.featured=1 b1.featured=1 group b1.id having count(b2.id) = (select datedif

How can I get text encoding system explicitly in Qt? -

it's easy turn string qtextcodec * following: char *str = "utf-8"; qtextcodec *codec = qtextcodec::codecforname(str); but can inverse? example: qtextcodec *codec = qtextcodec::codecforname("system"); but how can turn codec string know encoding system utf-8/utf-16 or others? but how can turn codec string know encoding system utf-8/utf-16 or others? by using qtextcodec::name() const . char *str = "utf-8"; qtextcodec *codec = qtextcodec::codecforname(str); qbytearray name = codec->name(); // "utf-8"

gnu make - Argh, makefile won't pick up dependencies correctly -

my simple little makefile exhibiting behavior i'm not able understand. if touch source file except dictionary.cpp no targets built, , if touch dictionary.cpp compiles doesn't link. source files in src/ object (.o) , dependencies (.d) in obj/ , binary goes bin/ if rm obj/* builds ok timestamps don't seem being picked up. can tell me i'm going wrong? the .d files seem being created correctly, here's dictionary.d: obj/dictionary.o: src/dictionary.cpp src/pch.h src/types.h src/util.h \ src/refcount.h src/dictionary.h src/dictionary.cpp: src/pch.h: src/types.h: src/util.h: src/refcount.h: src/dictionary.h: which looks correct me. here's makefile: sources = dictionary.cpp \ util.cpp \ tile.cpp \ board.cpp \ vec2.cpp \ letter.cpp \ random.cpp \ server.cpp \ main.cpp objects = $(patsubst %.cpp,obj/%.o,$(sources)) de

How to pass two dimensional array to a function in F#? -

i trying create function in f# takes input 2 dimensional array of integers (9 9), , prints content afterwards. following code shows have done : let printmatrix matrix= in 0 .. 8 j in 0 .. 8 printf "%d " matrix.[i,j] printf "\n" the problem f# not automatically infer type of matrix, , gives me following error: "the operator 'expr.[idx]' has been used object of indeterminate type based on information prior program point. consider adding further type constraints" . i tried use type annotation in definition of function, think did wrong. idea how can overcome issue? change let printmatrix (matrix:int [,])= in 0 .. 8 j in 0 .. 8 printf "%d " matrix.[i,j] printf "\n" this due how f# type infrence algorithm works

jquery - assign query result to variable and use it in javascript -

<script type="text/javascript"> $('x').load("https://blockchain.info/q/getreceivedbyaddress/1pt9trjkeaw61ar1elqpuzkdmayxzkctrn",function(){ var formatted_value=$('x').text();//$('**x**') selector class var goalgauge = new gauge(); goalgauge.draw(formatted_value); }); </script> <canvas id="gauge" width="240" height="240" style="display: block; width: 240px; margin: 0px auto;"></canvas></div> the query sends number used fill gauge. how assign received value var formatted_value ? it works now. code is: <div style="width: 100%; float: left;"> <div id="x"></div> <canvas id="gauge" width="240" height="240" style="display: block; width: 240px; margin: 0px auto;"></canvas> </div> <script type="text/javascript"> $('#x').load("https://bloc

kendo ui - DateTimePicker: disable time zone conversion -

i using kendo ui datetimepicker , faced binding issue. getting data json creating new js date based on json value , bind it. actual result date converted local timezone. can disable conversion local timezone? the datetimepicker not perform conversion. expect date not have time zone specificator , when creating new js date value considered utc , converted local. solve problem can bind date json without creating new js date.

python - Can't get the UNICODE chars -

i have encountered in problem while i'm trying unicode chars , put them in list. problem i'm getting hex code of symbols , not symbols themselves.. can me that? my code: keyslst = [] in range(1000, 1100): char = unichr(i) keyslst.append(char) print keyslst output: [u'\u03e8', u'\u03e9', u'\u03ea', u'\u03eb', u'\u03ec', u'\u03ed', u'\u03ee', u'\u03ef', u'\u03f0', u'\u03f1', u'\u03f2', u'\u03f3', u'\u03f4', u'\u03f5', u'\u03f6', u'\u03f7', u'\u03f8', u'\u03f9', u'\u03fa', u'\u03fb', u'\u03fc', u'\u03fd', u'\u03fe', u'\u03ff', u'\u0400', u'\u0401', u'\u0402', u'\u0403', u'\u0404', u'\u0405', u'\u0406', u'\u0407', u'\u0408', u'\u0409', u'\u040a', u'\u040b', u'\u040c', u

"Multichannel" development using git -

i'm developing app windows phone, using sdk version 7.1 (for wp7) , hosting in git repo. in order make available on windows phone 8 devices higher resolutions, created branch wp8 converted visual studio project , made necessary code adjustments. now continue developing on master , update functionality-related changes wp8 branch. first thought merge branches, fear 2 possible problems: when using merge , 1 branch disappear. (not true) firmware-related changes (wp7 → wp8) might overridden. is there proper way in git develop several different (but similar) target sdks depend on big amount of identical code? when using merge, 1 branch disappear. no, no branch disappear firmware-related changes ( wp7 → wp8 ) might overridden first, try rather rebase wp8 on top of master . is, try apply wp8 on top of master (see merge vs. rebase ). gary fixler comments below , makes sense branches short history (otherwise, re-applying old commits on top of

php - domxpath - Extract li tags from second ul -

i trying extract second ul's li tags following. unfortunately, there no classes or ids in html help <ul> <li>some text</li> <li>some text</li> <li>some text</li> </ul> <ul> <li>some more text</li> <li>some more text</li> <li>some more text</li> </ul> i have tried (a few things, actually): $ul = $xpath->query('//ul')->item(1); $query = '/li'; $lis = $xpath->evaluate($query, $ul); thinking me second ul, , can extract there. me second ul's html, i'm misunderstanding `->evaluate? because li's li's, not second ul. you can directly access them using xpath: $xpath->query('//ul[2]/li'); example: $html = <<<eof <ul> <li>some text</li> <li>some text</li> <li>some text</li> </ul> <ul> <li>some mo

Horizontally organised dynamic grid with CSS and jQuery -

the title bit misleading, not find more fitting title. i'm intensively working images on website , loading more 50 of them slows things down. wanted use lazyload delay load of images not yet in view port, however, layout not make possible. i have images right after each other: <div id="container"><img ..><img ..><img ..></div> and use css organise them separate columns. (to absolutely correct, images in divs well: <div class="pin"><img ..></div> here's css thing. #container { width:100%; padding:2px 2px 2px 2px; column-count:7; -webkit-column-count:7; -moz-column-count:7; -ms-column-count:7; -o-column-count:7; column-gap:2px; -webkit-column-gap:2px; -moz-column-gap:2px; -ms-column-gap:2px; -o-column-gap:2px; column-fill:balance; -webkit-column-fill:balance; -moz-column-fill:balance; -ms-column-fill:balance; -o-column-fill:balance; } .pin { display:block; wid

jsf 2 - change the components of one panel when an event occurs in another people -

suppose have left hand side panel , want change forms in panel based on event of components on left panel. how can in jsf? i searched little bit , found tabview in primefaces can this. know whether there way of changing contents of panel event of 1 panel. i understand question not quite specific searched on google , couldn't find satisfactory answer asking here. thanks :) 1. have context in center: left: <p:commandbutton update="pncenter" actionlistener="#{bean.update}"/> center: <p:outputpanel id="pncenter"> <p:outputpanel id="pn1" rendered="#{bean.render eq '1'}"> // content here </p:outputpanel> <p:outputpanel id="pn2" rendered="#{bean.render eq '2'}"> // content here </p:outputpanel> ///.... </p:outputpanel> 2. have dynamic center: (each center context stored in xhtml file) left: <p:commandbutton update="pnc

iphone - Array of plist update data -

i have 2 arrays init 2 different plist files, plist files inside document folder not in bundle editable. progress = [[nsmutablearray alloc] initwithcontentsoffile:[self progressfilepath]]; easy = [[nsmutablearray alloc] initwithcontentsoffile:[self easyfilepath]]; the progress plist empty insted easy is: <array> <dict> <key>titleen</key> <string>hunter</string> <key>status</key> <integer>0</integer> <key>image</key> <string></string> </dict> </array> now in view have tableview loaded easy , element press in row, if it’s status 0 goes progress plist, set object key image in dog.png in progress.plist set object 0 key status in easy one. did this: nsnumber *status = [[easy objectatindex:indexpath.row] objectforkey:@"status"]; if ([status intvalue] == 0) { [progress addobject:[easy objectatindex:

apache - PHP don't create the folder mkdir() -

i trying create new folder using php localhost/phpproject3/create.php: <?php mkdir('newdir', 0777); ?> but code doesn't it. doesn't work : <?php mkdir('/var/www/phpproject3/newdir',0777); ?> i installed lamp. think problem in settings (maybe chmod ?) because php script works. example create simple test.php: <?php echo 'great'; ?> and run it: localhost/phpproject3/test.php result great. i use netbeans. here files: /var/www/phpproject3 . run it: localhost/phpproject3/... content of /etc/apache2/sites-available/default: <virtualhost *:80> serveradmin webmaster@localhost documentroot /var/www <directory /> options followsymlinks allowoverride none </directory> <directory /var/www/> options indexes followsymlinks multiviews allowoverride none order allow,deny allow </directory> scriptalias /cgi-bin/ /usr/lib/cgi-bi

asp.net mvc - Is it possible to dynamically create a Entity Framework Entity Data Model? -

i realize dynamic query builder using aspnet mvc; ask user db parameters (hostname, db, user, passwd) , use linq query database using entity framework. doing need create entity data model @ runtime ... possibile similar thing? i'm ef fan doesn't fit in imho! i suggest use ado.net instead of trying use ef requirement. however, if you're against using ado.net maybe 1 of micro orms out there may better (e.g. dapper)

android - how to retrieve the country name and other information as long + lat -

this question exact duplicate of: how retrieve country name , other information long + lat (use emultor) i can retrieve other location information: country, city postal code ... i use method retrieve object: public address getaddress(double lat, double lng) { try { geocoder geocoder = new geocoder(contexts.getappcontext(), locale.getdefault()); threadtrack th = new threadtrack(); th.run();// pour attendre 50sec list<address> addresses = geocoder.getfromlocation(lat, lng, 1); address obj = addresses.get(0); return obj; } catch (ioexception e) { return null; } } i not have test smartphone android emulator, when displaying data displays fatal error, reply problem due using emulator not smartphone, how solve problem? check out link you can retrieve latitude, longitude , location info. please let me know if want other

wso2 - How to access the Header values in Wso2ESb -

this question has answer here: how can header in esb using following property, not not working 1 answer i using wso2esb when getting request mobile client header . issue unable access in wso2esb insequence further process how can have properties config is <log> <property name="faisal" expression="get-property('username')"/> <property name="username" expression="get-property('transport', 'accept')"/> <property name="username" expression="//username/text()"/> <property name="password" expression="//password/text()"/> </log> every thin showing me null , header sending this login {"password":"gbadmin","username":"faisal"} how can

php - Cron Job in Laravel -

this question has answer here: cron job laravel 4 3 answers i trying develop cron job command have created. new cron jobs dont know how works. trying command myself in console works perfectly. need able execute every 24 hours. using laravel 4, can help? thanks! to create cron job root, edit cron file: [sudo] crontab -e add new line @ end, every line cron job: 25 10 * * * php /var/www/<sitename>/artisan <command:name> <parameters> this execute same command @ 10:25am everyday. just make sure keep blank line after last one. , might need use full path of php client: 25 10 * * * /usr/local/bin/php /var/www/<sitename>/artisan <command:name> <parameters>

google app engine - Read from datastore not consistent -

i new google app engine, trying sample code , stuck :( below code: datastore = datastoreservicefactory.getdatastoreservice(); transaction txn = datastore.begintransaction(); entity oset = new entity("set", "set1"); datastore.put(oset); entity oitem1 = new entity("item", "item1", oset.getkey()); oitem1.setproperty("qty", "two"); datastore.put(oitem1); entity oitem2 = new entity("item", "item2", oset.getkey()); oitem2.setproperty("qty", "five"); datastore.put(oitem2); query query = new query("item").setancestor(oset.getkey()); list<entity> oitems = datastore.prepare(query).aslist(fetchoptions.builder.withlimit(50)); for(entity : oitems) { system.out.println("item qty: " + i.getproperty("qty")); } txn.commit(); i trying create 2 "item" entities 1 property "q

php - mysql request from two tables when one is empty -

i have 2 tables. , request return me 0 rows if second table empty , first - isn't... how can solve problem? table: users id username name email 1 myuname myname myemail@domain.com table: accounts customerid phone params 1 +1111 null my sql request below: select a.phone, a.params, u.email, u.username, u.name `account` a, `users` u a.customerid = u.id limit 1'; the request above return 0 rows if account table empty , users table isn't... how can solve problem? thanks. you can use left join: select a.phone, a.params, u.email, u.username, u.name `account` left join `users` u on a.customerid = u.id limit 1 a left join select rows first table , rows on second table matches. if there no match, u.email, u.username , u.name null.

jquery blueimp submits the file to a URL? -

i trying implement blueimp's file uploader in sample code. observed form tag follows: <form id="fileupload" action="//jquery-file-upload.appspot.com/" method="post" enctype="multipart/form-data"> so, action attribute specifies location on internet. mean files selecting upload being submitted url? please me understand.

java - how to unit test a class that uses a factory? -

if have class foo gets objects factory, how unit test foo? class foo { void dosth(){ anobject object = factory.instance().getobject(); object.dosth(); } } i'm going have call factory in unit test of foo, aren't i? is spring dependency injection give me advantage, because can do class foo { setfactory(factory factory){ this.factory = factory; } void dosth(){ anobject object = factory.getobject(); object.dosth(); } } or there workaround in non-spring world?

setting the x-axis when plotting convolution in matlab -

i plotting convolution in matlab purpose create 2 arrays representing values of functions in various points. x=[1:1000]; c=[1:1000]; t = linspace(-18,18,1000); k=1:1000, x(k)=input(t(k)); c(k)=h(t(k)); end; plot(conv(c,x)); the thing plots conv against place of answer in array. want plot conv against 'n' give value. plotting against t,c or x example above not give righ answer. plot here of length 1999. creating linspace of length 1999 plot wont give right answer. any suggestions?

php - How to use function flags? -

i want create class , extend php class filesystemiterator in following code. define method hasflag() , test whether contains flag (i want other php functions, eg. glob), result different expected. how can fix problem? class c extends filesystemiterator { /* these parent constants */ const current_as_fileinfo = 0 ; const key_as_pathname = 0 ; const current_as_self = 16 ; const current_as_pathname = 32 ; const current_mode_mask = 240 ; const key_as_filename = 256 ; const new_current_and_key = 256 ; const follow_symlinks = 512 ; const key_mode_mask = 3840 ; const skip_dots = 4096 ; const unix_paths = 8192 ; public function __construct($flags) { $this->flags = $flags; } public function hasflag($flag) { //how test $this->flags contains $flag??? return ($this->flags & $flag) ? true : false; } } $c = new c( c::current_as_filein

c# - Fixing 'method group' issue for delegate -

inspired cleanest way write retry logic? made this public static t retry<t>(int numretries, int timeout, delegate method, params object[] args) { if (method == null) throw new argumentnullexception("method"); var retval = default(t); { try { retval = (t) method.dynamicinvoke(args); return retval; } catch (timeoutexception) { if (numretries <= 0) throw; // avoid silent failure thread.sleep(timeout); } } while (numretries-- > 0); return retval; } however i've run method group problem. test setup private int add(int x, int y) { return x + y; } public static void main(string[] args) { var r = retry<int>(5, 10, add, 1, 1); } is there no better way fix other retry<int>(5,

android - Using InputStream to read file from internal storage -

i've searched couple days, , find using bufferedreader read file on internal storage. not possible use inputstream read file on internal storage? private void dailyinput() { inputstream in; in = this.getasset().open("file.txt"); scanner input = new scanner(new inputstreamreader(in)); in.close(); } i use input.next( ) search file data need. works fine, save new files internal storage , read them without changing bufferedreader. possible or need bite bullet , change everything? fyi don't need write, read. to write file. string filename = "file.txt"; string string = "hello world!"; fileoutputstream fos = openfileoutput(filename, context.mode_private); fos.write(string.getbytes()); fos.close(); to read void openfiledialog(string file) { //read file in internal storage fileinputstream fis; string content = ""; try { fis = openfileinput(file); byte[] input = new by

php - Ajax and Site Performance -

i learning php , ajax while creating plugin wordpress, managed finish up. counts number of clicks , impressions banner on sites gets. u place banners through plugin etc...anyway finished adding number of impressions each banner gets. works without problems. did on own , not tutorial wondering right way it: $(window).load(function() { $("a[count]").each(function(){ var id = $(this).attr("count"); var data = { action: 'impressions_count', postid: id }; $.post(myajax.ajaxurl, data, function(response) { console.log( response); }); }) }); and here 1 part of code updates db function impressions_count_callback() { global $wpdb; $post_id = $_post['postid']; //print_r($post_id); $post_id = mysql_real_escape_string($post_id); $wpdb->query("update ". $wpdb->prefix ."cb_ads_manage

scrollview - android scroll view nesting -

i'm trying make layout has structure: main_linear scroll_days days_linear scroll_day day hour part text1 text2 text3 text4 but end 1 scroll days. want every day have own vertical scroll, show 1 day on screen, slide left/right change days , slide up/down show hours. thanks help. maybe should use custom listview achieve that. you can have @ https://github.com/jimismith/pinnedheaderlistview listview handles groups.

c# - System.Speech down microphone sensitivity -

i know how down microphone sensitivity system.speech in c#.. to explain myself, have grammar file, , application should begin record me when sivraj (my program's name) however, can totally different, , application understand 'sivraj'... there part xml file : <rule id="mouskie" scope="public"> <item> <one-of> <item>sivraj</item> </one-of> </item> <ruleref special="garbage" /> <one-of> <item> <one-of> <item>quit</item> </one-of> <tag>$.mouskie={}; $.mouskie._value="quit";</tag> // quit programm when sivraj + quit </item> ..... etc etc and function start recognition engine : srgsdocument xmlgrammar = new srgsdocument("grammaire.grxml"); grammar grammar = new grammar(xmlgrammar); asrengine = new speechrecognitionengine(); asrengine.setinputtodefaultaudiodevice(); asrengine.loadgram

git - how to merge all forks of same repo by different user in github -

i using gihub , created private repo. have added few collaborators. have created own fork of main repo. working own fork cloning local pc. using git windows client clone, commit, sync repo. when commit, changes visible own fork. no 1 can see changes commit other collaborator of repo. every 1 needs changes other collaborator commit own fork. how merge forks different collaborators can see everyone's changes? please help. i think can use pull request . take this article, explain how pull request in github.

non-jquery css animation on page-load and page-unload/exit-page -

is there a non-jquery way have purely css based animation run on page load , animation run on page-unload/exit-page? animations on load can done css alone, animations on click think you'll need little jquery. are looking this? - jsfiddle $('#container').click(function () { $('#container').fadeout(); $('#quote1').fadein().addclass('bounceinleft'); }); $('#quote1').click(function () { $('#quote1').fadeout(); $('#quote2').fadein().addclass('bounceinright'); }); you can hover triggered animations in css alone. connect 2 or more elements think have nested. in hover on parent, animate child.

android - Why Is ActionBarSherlock Menu Not Working? -

im noob android development , i'm having issue making menu item listener work. when click on menu item toast supposed display nothing happens. have correct imports , have implemented menuitem listener don't understand why not working. appreciated. //abs menuitem import import com.actionbarsherlock.view.menuitem.onmenuitemclicklistener; @override public boolean oncreateoptionsmenu(menu menu) { menu.add(0,1,0,"gender").seticon(r.drawable.female_icon).setonmenuitemclicklistener(this).setshowasaction(menuitem.show_as_action_always); menu.add(0,2,0,"flip").seticon(r.drawable.flip_icon).setonmenuitemclicklistener(this).setshowasaction(menuitem.show_as_action_always); menu.add(0,3,0,"preferences").seticon(r.drawable.ic_action_example).setonmenuitemclicklistener(remedyactivity.this).setshowasaction(menuitem.show_as_action_always); menu.add(0,4,0,"help").seticon(r.drawable.info).setonmenuitemclicklistener(remedyactivity.t

c# - Check if label is more than a specific value -

i made clock , want users able select timezone, clock can go on 24 hours should not possible, needs start on @ 00:00 . this i've come far, keep getting error input string not in correct format. if (convert.toint32(label1.text) > 24) { int test = convert.toint32(label1.text) - 24; label1.text = test.tostring(); } i've tried searching around , thing come tryparse doesn't work either you should have instance of business object represent clock entity. , label should display values/properties of business object. public class clock { private int _hour; public void increment() { if (_hour > 23) _hour = 0; else _hour++; // raise event } public event eventhandler hourchanged; public int hour { { return _hour; } } } instanciate class in windows forms application, sign event , show hour property

php - Set Session Ajax Post -

anyway set session when remote login ajax . this code var result = null; var scripturl = "http://www.site.com/login.bs"; $.ajax({ url: scripturl, type: 'post', data: ({txttitle : 'tt1', txttext : 'tt2'}), datatype: 'json', async: false, success: function(data) { alert("success"); }, error: function (err) { alert("error"); } }); in target page when login session[user] set . when refresh page alert error . target code if($_post[txttitle]=='tt1' && $_post[txttext]=='tt2') { $_session[user]='ok'; } on backend, javascript expecting sort of json response. datatype: 'json' try: header('content-type: application/json'); echo json_encode(array());

java - Strange FTPClient.storeFile behaviour -

i'm having problems uploading file ftp server. i wrote code should connect ftp server, login, , upload file using apache commons net ftpclient: ftpclient client = new ftpclient(); client.connect("somesite.com"); client.login("user", "password"); system.out.println("connected"); client.cwd("images/bar"); system.out.println("cwd succesful. full reply: "+client.getreplystring()); fileinputstream fis = new fileinputstream(new file(system.getproperty("user.dir")+file.separator+"current_690.jpg")); client.storefile(image_name, fis); system.out.println("succesful store. full reply: "+client.getreplystring()); the output terminal is: connected cwd succesful. full reply: 250 ok. current directory /images/bar succesful store. full reply: 226-file transferred 226 3.190 seconds (measured here), 9.99 kbytes per second the problem if go user.dir , open current_690.jpg displays me image co

elisp - emacs: get lexically bound variable value by name -

this question has answer here: lexical eval in emacs24 3 answers the following not work void variable error. should eval replaced work? ;; -*- lexical-binding: t -*- (defun foo2 () (let ((b 'lkj)) (lambda () (eval 'b t)))) (funcall (foo2)) symbol-value doesn't work either (as documented). looking variable's value name fundamentally incompatible proper lexical scoping, because proper lexical scoping admits alpha-renaming, i.e. (consistently) renaming variable should not affect result. of course, if must know, can hack things around in cases, doing things like: (funcall `(closure ,(nth 1 <someclosure>) () <exp>)) which might evaluate <exp> in same scope 1 <someclosure> comes. won't work if <someclosure> byte-compiled (or if made mistake).

Jquery animate blur function -

i using jquery blur plugin called "vague.js". allows me blur on website. want animate blurring. how call .blur() function jquery animate() ? //this sets plugin , applies blur content var contentblur = $('#content').vague({intensity:5}); contentblur.blur(); i want like: contentblur.animate(blur,500); https://github.com/gianlucaguarini/vague.js you can make blur animated on browser support filter property , transitions. it's easy setting transition on element #content { transition: 1s; -webkit-transition: 1s; } you can see jsfiddle demo : http://jsfiddle.net/vmws3/

security - Wordpress XSS vulnerabilty (grabbing PHPSESSID) -

i started study vulnerability of websites , i've got doubt wordpress's xss vulnerability. exploit, attacker can grab phpsessid simple javascript's command: (alert(document.cookie)) how can attacker use this? serious security problem or not? an alert(…) proof of concept demonstrates successful exploitation of xss vulnerability. not used in actual attack doesn’t give attacker benefit. in real attack, attacker try value of document.cookie somehow. simple example use javascript forge simple http request contains value of document.cookie this: new image().src="http://evil.example/?"+document.cookie this creates image attacker’s url image source has cookie appended it. with victim’s cookie, attacker may able hijack victim’s session , use wordpress same privileges victim. in case victim administrator, attacker have access administrative functions.

xamarin.ios - Monotouch Admob dll file size -

i have downloaded xamarin's binding admob here , see googleadmobads.dll size 16mb - file should use in app? it's seems rather large , unreasonable. please advise :) thanks! the native libgoogleadmodads.a 15mb, looks quite normal actually. have in mind libgoogleadmodads.a contains code 3 architectures (i386, arm7 , arm7s), , since you'll use armv7 in app (i386 when you're using simulator - , when building device might building both armv7 , armv7s @ same time, not common), you'll use ~5mb of 15mb.

objective c - Why doesn't my UIKeyboard disappear on resignfirstresponder -

this ridiculous, cant't see whats wrong code. hope can me right. problem when resignfirstresponder fires seems uikeyboard appears, note done button changes ordinary return button on keyboard. my testviewcontroller.m file #import <quartzcore/quartzcore.h> #import <uikit/uikit.h> #import "testviewcontroller.h" #define koffset_for_keyboard 216.0 @interface testviewcontroller () { float increase; int increases; uitextview *txt; uiview *vw; uiview *tvw; uitableview *tbl; uibutton *b; } @end @implementation testviewcontroller - (void)viewdidload { vw =[[uitextview alloc]initwithframe:cgrectmake(0, self.view.frame.size.height-34, 320, 1000)]; vw.backgroundcolor =[uicolor blackcolor]; tbl =[[uitableview alloc]initwithframe:cgrectmake(0, 0, 320, self.view.frame.size.height-34)]; txt =[uitextview new]; txt.frame=cgrectmake(4, 4, 255, 25); [txt setscrollenabled:no]; txt.contentinset = uiedgeinsetsmake(4,

c - "bind: address already in use" even with SO_REUSEADDR set -

i've written simple echo server, includes following line: int yes = 1; if (setsockopt(socketfd, sol_socket, so_reuseaddr, &yes, sizeof(int)) == -1) { perror("setsockopt"); exit(1); } however despite this, i'm still getting error when try call bind on socket i've used. in fact, i'm getting error if try call bind on socket i've used in program, period, if it's not recent - they're not being cleared kernel or something. there else have do? here's full code: #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/types.h> #include <sys/socket.h> #include <netdb.h> #include <arpa/inet.h> #include <unistd.h> void preparehints(struct addrinfo *hints, int tcp_udp) { memset(hints, 0, sizeof(struct addrinfo)); hints->ai_family = af_unspec; hints->ai_socktype = (tcp_udp == 1) ? sock_stream : sock_dgram; hints->ai_flags = ai_passive; /* auto

java - POJO Annotations are not being reflected with Kundera -

i writing 1 simple spring batch application reads data file , write cassandra db. if run cassandra crud operations in simple java project 1 single below dependency, able run properly. , execute crud operations successfully. dependency : com.impetus.client kundera-cassandra 2.5 now here comes problem! i integrating same code spring batch application. ending below exception: 10:22:19,816 debug threadpooltaskexecutor-1 dao.jdbcstepexecutiondao:203 - truncating long message before update of stepexecution, original message is: org.springframework.batch.core.jobexecutionexception: partition handler returned unsuccessful step @ org.springframework.batch.core.partition.support.partitionstep.doexecute(partitionstep.java:110) @ org.springframework.batch.core.step.abstractstep.execute(abstractstep.java:196) @ org.springframework.batch.core.job.abstractjob.handlestep(abstractjob.java:375) @ org.springframework.batc

google cloud print - How can I create a PDF programmatically in iOS -

this question has answer here: how create pdf document using iphone sdk? [duplicate] 4 answers i want create pdf labels , image , table set of rows in ios programmatically. please suggest idea this. how can enable google cloud priniting in ios programmatically? void createpdffile (cgrect pagerect, const char *filename) { // code block sets our pdf context can draw cgcontextref pdfcontext; cfstringref path; cfurlref url; cfmutabledictionaryref mydictionary = null; // create cfstring filename provide method when call path = cfstringcreatewithcstring (null, filename, kcfstringencodingutf8); // create cfurl using cfstring defined url = cfurlcreatewithfilesystempath (null, path, kcfurlposixpathstyle, 0); cfrelease (path); // dictionary contains options 'signing' pdf mydiction

android - Can't display one string from array on button press -

i'm new arrays in java , our final project, instead of creating 3000 activities, decided use single array house strings. problem i'm having when press button change string on screen, either skips end or adds somehow. want show 1 string @ time , cannot, life of me figure out. here code: public class mainactivity extends activity { mediaplayer snake; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); final string[] lines = {"so begins story of our hero.","his name solid snake.","he international spy, elite solider, , quite ladies man.", "snake likes sneak around in cardboard box.","most enemies aren't smart enough catch him in it."}; snake = mediaplayer.create(this, r.raw.maintheme); snake.start(); final textview tv = (textview)findviewbyid(r.id.textview1)

How to retrieve an object from a Python Dictionary -

i'm trying retrieve object i've placed dictionary, every time try retrieve receive error: class csventry: lat = [] lon = [] count = 0 # create dictionary tracking inputs dict = defaultdict(list) # lookup zipcode (returns integer value) zipcode = convertlatlontozip(row[latcol], row[loncol]) # if zipcode in dictionary, update new count if zipcode in dict: oldentry = dict[zipcode] oldentry.lat.append(row[latcol]) oldentry.lon.append(row[loncol]) oldentry.count = dict[zipcode].count + 1 # otherwise, make new entry else: entry = csventry() entry.lat.append(row[latcol]) entry.lon.append(row[loncol]) entry.count = 1 # hash on zipcode dict[zipcode].append(entry) it has no problem inserting entries dictionary, finds duplicate, fails error: traceback (most recent call last): file "parsecsv.py", line 125, in <module> oldentry.lat.append(row[latcol]) attributeerror: 'list' obj

windows - Netbeans C++ trys a relative path for make.exe -

i reinstalled windows on 1 pc i'm failing in reinstalling netbeans c++ mingw/msys , qt 4.8.3. everytime try build error message comes up: "/d/eigene dateien/dokumente/netbeansprojects/test_1/"c:/msys/1.0/bin/make.exe"" -f nbproject/makefile-debug.mk qmake=/c/qt/4.8.3/bin/qmake.exe subprojects= .build-conf /bin/sh.exe: /d/eigene dateien/dokumente/netbeansprojects/test_1/c:/msys/1.0/bin/make.exe: no such file or directory make.exe": *** [.build-impl] error 127 build failed (exit value 2, total time: 964ms) it seems me trys execute commands relativly project path. on laptop did same when installed netbeans 7.2.1 (now it's 7.3, maybe cause of that?) , hadn't issue. this bug caused java 7u21 in netbeans 7.3. see https://netbeans.org/bugzilla/show_bug.cgi?id=228730 . 1 workaround, if not want upgrade (although don't see why not want upgrade) add msys' bin directory path, , use make.exe command make (as opposed c:\msys\bin\make

actionbarsherlock - Android Action Bar Sherlock Illegal Argument Exception after running Proguard -

this question has answer here: noclassdeffounderror when using proguard 1 answer i have used proguard first time (ever), , having copied exported apk emulator, i received illegal argument exception : class not annotated @implementation @ com.actionbarsherlock.a.a(unknown source) as proguard appears have saved me around 400kb, keen use if possible. can suggest approach here - don't want exclude abs .jar - project has grown since starting use abs. did add proguard lines abs website? -keep class android.support.v4.app.** { *; } -keep interface android.support.v4.app.** { *; } -keep class com.actionbarsherlock.** { *; } -keep interface com.actionbarsherlock.** { *; } -keepattributes *annotation* see http://actionbarsherlock.com/faq.html

Android publish app with Google map 1.0 -

i created new android app google maps v1 , when tried publish see google map v1 not sopported google . there way publish app v1? thanks the short answer be: no, unless have generated release api key before service became deprecated. google doesn't provide keys google map api v1, therefore unless have registered application's release key google's api console, afaik there no way right now. as mentioned in comment, there lot of resources port api v1 implementation api v2, can take @ blog post wrote on integrating google map api v2 in application: google map api v2

sup - Connexion to sup2.2 -

i develop ios application , , need develop connexion interface ( user,password).pressing connect button must synchronise sup2.2 .i folowed many tutorial still couldn't connect server sup2.2.any idea please. there tutorials available guide u step step. follow on sybase infocentre. tutorial ios object api application development also, if can specify getting stuck or error is, resolve problem.

Making A Statistics Text File (Python) -

i'm making program takes name , input in form of numbers , gives them score want score saved in text file , want able multiple times when write file overwrites last stat there anyway change here function i'm using: def calculate(): try: = float(enter1.get()) b = float(enter2.get()) c = float(enter3.get()) d = float(enter4.get()) e = float(enter5.get()) f = float(enter6.get()) result =(a+b+(c*2)+(d*2)+e-f)*2.5 n = result w = "score:" label7.config(text=str(result)) myfile = open('stats.txt','w') x = str(enter0.get()) y =("(%s) %s" % (w, n)) myfile.write(x) myfile.write(y) myfile.close() except valueerror: label7.config(text='enter numbers!',fg="white") maybe change myfile = open('stats.txt','w') into myfile = open('stats.txt','a'

Curl script in PHP "unexpected T_VARIABLE" -

i trying reproduce curl script in php page: `$ curl -f userfile=@image_file_name \ -f outputencoding="utf-8" \ -f outputformat="txt" \ http:// server_address /cgi-bin/submit.cgi >result.tx` i trying build this: <?php $file="test.jpg" $cmd="curl -f userfile=$file \ -f outputencoding=\"utf-8\" \ -f outputformat=\"txt\" \ http://maggie.ocrgrid.org/cgi-bin/weocr/ocr_scene.cgi >result.txt" exec($cmd, $result) echo $result; ?> but keep getting: parse error: syntax error, unexpected t_variable in /.../default.php on line 4 i have tried scaping , not scaping the quotation marks , looks that's not issue, suggestion?

jsf 2 - HTTP status code 500 (internal server error) while loading a JSF page -

<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets"> <body> <h:form><center> <h:panelgrid columns="2"> <h:outputtext value="login: " /> <h:inputtext value="#{usbusiness.user.login}"/> <h:outputtext value="mot de passe:" /> <h:inputext value="#{usbusiness.user.pwd}" /> <h:commandbutton id="submit" action="#{usbusiness.user.connecter}" value="connecter" /> <h:commandbutton id="submit" action="#{usbusiness.user.connecter}" value="annuler" /> </h:panel

matlab - PIV Analysis, Interrogation Area of The Cross Correlation -

i'm running piv analysis on 2 consecutive images taken during experiment vector field. know, based on criteria have choose percentage of overlap between tow images cross-correlation process? 50%, 75%...? pivlab_gui tool designed matlab chooses 50% overlap default, allows changing it. want know criteria based on can know how overlap best? vectors become less accurate, dependent.etc, increase/decrease overlap? book "fluid mechanics measurements" not explain how choose overlap amount in cross-correlation process, , not find helpful online reference. appreciated. i suggest read on spectral estimation - equivalent cross correlation when segment data , average correlation estimates calculated each segment (the cross correlation inverse fourier transform of cross spectrum). there's book chapter on stuff here , may want find more complete resource if unclear on basics. a short answer: increasing overlap increase frequency resolution of spectral estimate, , g

Use javascript to detect if a youtube video is having trouble loading and playing -

is possible, using javascript, detect if embedded youtube video pauses playback in order let video buffer? know there events fire when user presses pause, i'm looking event fires when video pauses due slow connection. i'm creating web application it's important have video play through smoothly. if video pauses due slow connection, want detect that. use code player.getplayerstate():number seems allowed ask player status in may you https://developers.google.com/youtube/js_api_reference

objective c - UIStoryBoard Navigation Controller disappearing after segue -

reference layout via storyboard: http://i.imgur.com/m7amdp2.png reference landing page: http://i.imgur.com/y3g45uy.png i trying use bottom bar displayed in picture 2 control app. when select option on first page (such songs tab), when go next page navigation bar @ bottom disappears. using segues direct applications view flow. i have tried making various controllers subclassed uitabbarcontroller & pushing modal. neither of kept navigation controller you shouldn't have navigation controller initial controller, tab bar controller should first. then, in each of 3 tabs, root view controller should navigation controller, followed ones show in image.

PHP Jquery Resize blocks hiding the DIV info -

the code in link below allows drag , resize little boxes. boxes have text in them text isn't showing because it's being covered something, believe resize boxes. i've tried no luck change settings , tinker can't find can figure out. why info being covered up? code: http://plnkr.co/edit/psdru38mi8z186m8ynmn they being hidden jquery ui resize div s. jquery ui positions small div s @ corners of resizable div, , styles them small , margin-less. problem css rule: #set div { background: none repeat scroll 0 0 black; color: white; float: left; height: 90px; margin: 0 10px 10px 0; padding: 0.5em; width: 90px; } this overriding default ui styles .ui-resizable-[x] because div s within #set block. basically, you're inadvertently resizing little corner-resize div s because rule applies div s in block id of set . change rule to: #set div.resizable { background: none repeat scroll 0 0 black; color: white; flo

ios - App created with AIR 3.4 Won't Work in AIR 3.7 -

i overlaid air 3.7 flex 4.9.1 sdk. ios app created works 3.4 (which created with). part of app either take picture or camera roll (and save compressed version) however, in 3.7 app hangs once mediaevent.complete code called (code below) ideas, need add loadercontext? protected function oncomplete(event:mediaevent):void { //busy indicator bi = new uploadalert(); //upload alert component created display busy indicator bi.x = this.width/2 - 150; bi.y = this.height/2 - 150; //get number of elements allelements = this.numelements; this.addelementat(bi, allelements); var cameraui:cameraui = event.target cameraui; var mediapromise:mediapromise = event.data; var mploader:loader = new loader(); mploader.contentloaderinfo.addeventlistener(event.complete, onmediapromiseloaded); mploader.loadfilepromise(mediapromise); }

Codeigniter, Displaying results from database -

i new ci, i've been working on hours no success, please help! trying generate user profiles retrieving information database , displaying in view (using userid). getting both undefined variable error , trying property out of non-object error. here code: model: public function my_data() { $userid = $this->session->userdata('userid'); $data = array(); $this->db->select('*'); $this->db->from('user_profile'); $this->db->where('userid', $userid); $query = $this->db->get(); return $query->result(); } controller: public function profile() { $data['query'] = $this->user_model->my_data(); $this->load->view('header_loggedin'); $this->load->view('sidebar_left'); $this->load->view('user/user_profile', $user); $this->load->view('footer'); } view: <div class="control-group