Posts

Showing posts from March, 2014

xcode - iOS UIText Field Place holder font size/style -

anybody know of way can set font size placeholder in uitextfield? thanks you can programmatically setting value key @"_placeholderlabel.font" [self.input setvalue:[uifont fontwithname: @"american typewriter bold" size: 20] forkeypath:@"_placeholderlabel.font"];

html - Align <li> with <input> with the text -

Image
i align text , input in li horizontaly aligned menu on left. here how looks. i need newsletter align menu on left. css #footer .div1{ float:left; } #footer ul{ list-style:none; } #footer li{ float:left; padding-left:20px; font-size:18px; } #footer li:first-child{ padding-left:0px; } html <div id="footer"> <div class="div1"> <ul> <li><b>we &hearts; network</b></li> <li>facebook</li> <li>blog</li> <li>contact</li> <li>newsletter : <input type="text" name="email" id="emailnl" style="font-family:arial; width:200px; margin:0px; padding:0px;"/> <span id="submitnl" style="cursor:pointer">ok</span></li> </ul> </div> <div style="clear:both"></div> </div> thanks image updated! wi

mysql - php mail with variables -

i attempting setup mail script first run simple select mysql, , use these array variables in message. variables not output message body, 1 row of variables. here script: $sql1 = "select * videos checked_out = '1'"; $result1 = $dblink->query($sql1); while($row1 = $result1->fetch_assoc()) { $name = $row1['name']; $tape_no = $row1['tape_no']; $member_name = $row1['member_name']; $date_out = date("f j, y", strtotime($row1['date_out'])); } //email function administrator $to = "nouser@mail.com"; $subject = "daily video rental summary"; $message = "$name $tape_no $date_out $member_name ====================================================================== please not reply message, mailbox not monitored ======================================================================"; $from = "no_replies_please@mail.com"; $headers = "

javascript - Child window closes in IE9 on click of Button -

so have javascript code onclick of button child window opened parent window. try{ window.opener.item(23,add,document.addedit.name.value,document.addedit.type.value); } catch(err){ alert('the form editing not available.'); } item function in parent window - function item(id,action,name,type){ savescroll(); document.abc.itemid.value = id; document.abc.itemaction.value = action; document.abc.itemname.value = name; document.abc.itemtype.value = type; document.abc.submit(); } so somehow getting error catch block. happens in ie9, works in firefox, ie8, chrome. error " member not found ". has faced issue in ie9? i'm not sure since don't have ie, have tried declaring 'item' instead:- var item = function(id, action, name, type) { //etc } the other thing i'd try renaming 'item' else in case there's name clash...

ruby - How to detect an array- or set-like value while avoiding type checks -

i have method accepts argument can array/set-like object, or hash. gist of method like: def find(query = {}) if array === query or set === query query = {:_id => {'$in' => query.to_a}} end mongo_collection.find(query) end the method accept set of id objects , turn hash condition mongodb. two problems above code: it fail if 'set' not required standard library. don't want require dependency perform check. i don't want strict type comparisons. want accept array- or set-like value , cast array of values to_a . how perform check? considerations have in mind: i check to_ary method, set doesn't respond to_ary . objects implement method should fundamentally arrays, , agree set isn't fundamentally array. see consequences of implementing to_int , to_str in ruby i can't check to_a since hash responds it methods common array , set, not hash are: [:&, :+, :-, :<<, :collect!, :flatten!, :map!, :|] i decided go

java - Jaxb, Class has two properties of the same name -

with jaxb, try read xml file few element in xml file interesting, skip many element xml content xml try read <?xml version="1.0" encoding="utf-8"?> <!--sample xml file generated xmlspy v2010 rel. 3 sp1 (http://www.altova.com)--> <flx:modelerep xsi:schemalocation="urn:test:mod_rep.xsd mod_rep.xsd" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:flx="urn:test:mod_rep.xsd"> <flx:documentheader> <flx:identification v="04489"/> </flx:documentheader> <flx:timeseries> <flx:identification v="test1a"/> <flx:businesstype v="a01"/> <flx:product v="123a"/> <flx:resourceobject codingscheme="n" v="testa"/> <flx:period> <flx:timeinterval v="2011-07-02t00:00/2011-07-16t00:00"/> <flx:resolution v="pt2h"/> <flx:pt>

jquery - Uplodify onSelect event problem! -

i need validate selected file in onselect event , according modify content of uplodify element example change error style , hide progress , add description in percentage div! problem not find uplodify content in onselect event!!! there solution problem? my code here : var $max_file_size = 1024000; var $arr_allow_extention = ['.jpg', '.gif', '.png']; //console.log($arr_allow_extention); $($idselector).uploadify({ 'uploader' : $project_public_path + '/share/library/uploadify/uploadify.swf', 'script' : $project_public_path + '/share/library/uploadify/uploadify.php', 'cancelimg' : $project_public_path + '/share/library/uploadify/cancel.png', 'folder' : $project_public_path + '/uploaded_resource/bug', 'sizelimit' : $max_file_size, // 10 mb 'auto' : false, 'buttontext' : ' browse ', 'fileext' : '*.jpg;

python - Django: Null field with managed=False -

when model not managed django, matter value of null on field is? managed=false no database table creation or deletion operations performed model. so, field null or not null not reflect through code written in models.py

websphere portal - Confusion in understanding portlet terms -

can please explain in lay terms beginner: difference between : portlet, portlet label, potlet page? for websphere portal server . portlets pages labels managing pages

c# - Black image when saving PNG from clipboard -

i trying save png image has been copied clipboard, either turning out solid black, or black around areas should transparent. here code using capture , save image var clipboardimage = (interopbitmap)clipboard.getimage(); image.saveimage(clipboardimage, path.combine(config.app.applicationdataimagespath, string.format("{0}.{1}", imageid, "png"))); public static void saveimage(bitmapsource bitmapimage, string filename) { using (var filestream = new filestream(filename, filemode.create)) { var pngbitmapencoder = new pngbitmapencoder(); pngbitmapencoder.frames.add(bitmapframe.create(bitmapimage)); pngbitmapencoder.save(filestream); filestream.close(); filestream.dispose(); } } does have ideas why won't persrve alpha channels of png? thanks dan edit: should of mentioned black images happening when copying image internet explorer 9. works when copying image either chrome or firefox. workaro

android - With a non-blocking SocketChannel, is the affiliated Socket blocking? -

i'm developing android app, trying non-blocking write 1 thread on socket, while doing blocking read on thread. i'm looking through socketchannel docs , trying figure out configureblocking does. specifically, if have non-blocking socketchannel, , access affiliated socket socketchannel.socket(), socket non-blocking in way? or blocking? in other words, can effect of 1 blocking direction , 1 non-blocking direction having non-blocking socketchannel non-blocking direction, , using affiliated socket other direction? if socket has associated socketchannel , cannot directly read it's inputstream . you'll illegalblockingmodeexception . see here . you can block on non-blocking socketchannels registering them selector , using select() or select(long timeout) . methods block until registered channel ready (or timeout expired). the channel still non-blocking threads not using selector. modified example here : selector selector = selector.open(); channel.con

How to match any character in regex -

how can match characters including new line regex. trying match characters between brackets "()". don't want activate dot matches all. i tried \([.\n\r]*\) but doesn't work. (.*\) doesn't work if there new line between brackets. i have been using http://regexpal.com/ test regular expressions. tell me if know better. i'd use \([\s\s]*\) in situation. the [\s\s] match whitespace or non-whitespace character.

javascript - How do I put id number from select tag to a php link? -

Image
currently, have far, it's not working: <form> <select name="patientid" id="patientselect"> <?php $qpatient = mysql_query("select idpatients, firstname, mi, lastname, suffix patients order lastname asc"); while($rowpatient = mysql_fetch_array( $qpatient )) { if(isset($rowpatient['suffix']) && !empty($rowpatient['suffix'])){$suffix = " " . $rowpatient['suffix'];}else{$suffix = null;} if(isset($rowpatient['mi']) && !empty($rowpatient['mi'])){$mi = " " . $rowpatient['mi'] . ".";}else{$mi = null;} echo "<option value=" . $rowpatient['idpatients'] . $rowpatient . ">" . $rowpatient['lastname'] . $suffix . ", " . $rowpatient['firstname'] . $mi . "</option>"; } ?> </select> <a id="updatelink" href="">

Wrong result from IsNumeric() in VB.NET -

i have function in vb.net loops through values , attempts convert decimal if isnumeric true, dim value string if isnumeric(value) = true rate = ctype(value, decimal) <--- bombing here end if i've found when function receives value 603e43 isnumeric evaluates true reason , bombs on conversion. why isnumeric true in case? see http://support.microsoft.com/kb/329488 isnumeric returns true if can converted double true 603e43 value larger decimal can hold you use decimal.tryparse funcion working alternative. see http://msdn.microsoft.com/en-us/library/9zbda557.aspx

Enforcing Java minimum version to run with "java -version:<value>" doesn't work on Windows -

i want enforce minimum version of jvm application should run on 1.6 or greater (i.e. 1.6+). understanding can using "-version:" command line argument. tried it, , seemed work fine under linux not under windows. linux i have jdk version 1.6.0_21 installed on linux machine. $java_home , $path environment variables have been set should be. i ran following: $ java -version:1.6+ -version java version "1.6.0_21" java(tm) se runtime environment (build 1.6.0_21-b06) java hotspot(tm) 64-bit server vm (build 17.0-b16, mixed mode) $ java -version:1.5+ -version java version "1.6.0_21" java(tm) se runtime environment (build 1.6.0_21-b06) java hotspot(tm) 64-bit server vm (build 17.0-b16, mixed mode) $ java -version:1.7+ -version unable locate jre meeting specification "1.7+" all seemed expected. "version:1.6+" , "version:1.5+" should work because have jdk 1.6.0_21 installed, , "version:1.7+" shouldn't beca

spring - how will container start ApplicationContext.xml file -

i have application implemented in struts. trying move spring doing step step. first plan implement ioc (di). got daos fixed, got applicationcontext.xml fixed when try run application (ofcourse) not create beans me through applicationcontext.xml(sometimes known beans.xml) automatically. in understanding need applicationcontext.xml initialized before service classes call method of daos. proper flow of spring's ioc or how container start applicationcontext.xml file. did add needed tags web.xml? <context-param> <param-name>contextconfiglocation</param-name> <param-value>web-inf/applicationcontext.xml</param-value> </context-param> <listener> <listener-class>org.springframework.web.context.contextloaderlistener</listener-class> </listener>

perl get session cookie -

is not work cookie #!/usr/bin/perl -w use strict; use warnings; use lwp::useragent; use http::request::common qw(get); use http::cookies; $ua = lwp::useragent->new; # define user agent type $ua->agent('mozilla/4.0'); # cookies $ua->cookie_jar( http::cookies->new( file => 'mycookies.txt', autosave => 1 ) ); # request object $req = 'http://www.google.com'; # make request $res = $ua->request($req); # check response if ($res->is_success) { print $res->content; } else { print $res->status_line . "\n"; } exit 0; when cookie ( firebug ) name value pref id=00349dffbc142a77:ff=0:ld=en:cr=2:tm=1311217451:lm=1311217451:s=qkw9g4vawl19me4g mycookies.txt is #lwp-cookies-1.0 set-cookie3: pref="id=00349dffbc142a77:ff=0:tm=1311217451:lm=1311217451:s=qkw9g4vawl19me4g"; path="/"; domain=.google.com; path_spec; expires="2013-07-20 03:04:11z"; version=0

parsing - Removing tags from xml file for BlackBerry -

i developing blackberry app needs read xml file. able read remove tags such <?xml version='1.0' encoding='utf-8'?> , <feed> , <author> , on... i'm using blackberry 9800 simulator. have checked file atom 1.0 file. how should remove these tags? currently codes of got internet. displays 'id' , 'updated' date of file. how can display/filter data away , remove tags? thanks, hend class myapp extends uiapplication{ //creating member variable mainscreen mainscreen _screen= new mainscreen(); //string variables store values of xml document string _node,_element; connection _connectionthread; public static void main(string arg[]){ myapp application = new myapp(); //create new instance of application //and start application on event thread application.entereventdispatcher(); } public myapp() { _screen.settitle("xml parsing");//setting title _screen.add(new richtextfield("requesting.....&q

ruby on rails - on_the_spot gem not working -

i have installed "on_the_spot" gem following github instructions. and i'm trying create in-place edit index action. when mouse on text should editable, nothing happens. background color changes. this relevant code index view <% @part_types.each |part_type| %> <tr> <td><%= on_the_spot_edit part_type, :title %></td> </tr> <% end %> from controller: class parttypescontroller < applicationcontroller #on_the_spot in place editing can_edit_on_the_spot #.. rest of controller code end added routes: resources :part_types collection put :update_attribute_on_the_spot end end nginx restarted after these changes. thank you inside gemfile add following: gem "on_the_spot" run installation task: rails g on_the_spot:install if u using rails 3.1 replace created files app/assets/javascripts (two files jquery.jeditable.mini , on_the_spot)

event log - Python WINEVTLOG Open Backup Logs -

i attempting use openbackupeventlog("",file) open eventlogs saved on cdrom. going through loop load each file under subdirectory. have 2 issues @ moment. 1. script pull first file name , output events on screen, when reach end not reset. 2. when goes through second position of list gives error of file not found. import win32evtlog e = os.listdir('d:\\somedir\\anotherdir\\') item in range(len(e)): handle = win32evtlog.openbackupeventlog("none", e[item]) flags = win32evtlog.eventlog_backwards_read|win32evtlog.eventlog_sequential_read total = e.getnumberofeventlogrecords(handle) print "total events are: ", total while true: event_list = win32evtlog.readeventlog(handle, flags, 0) if event_list: event in event_list: info = (event.eventtype, event.timegenerated, event.sourcename, event.eventid) print info a

objective c - When exiting an App, do I have to release the pointers or is it done automatically? -

when exit out of app, released? or if have pointer-arrays(malloc), have release pointers before exiting app? thanks this not defined c specification (and not formally defined in objective-c) on ios , other modern operating systems, when process terminates, memory returned system. yes, such pointers freed appropriately, though c++ destructors , objective-c -dealloc implementations not run.

asp.net mvc 3 - How can I unit test an AuthorizeWhereIn attribute with Ninject -

i'm using custom authorisation attribute (blatantly plagiarised answer) have hit hurdle can't find way unit test it. unfortunately need unit test @ same time invoke controller action i'm trying find way ninject dependency injection in unit test. the authorizewherein attribute is: public class authorizewherein : authorizeattribute { /// <summary> /// add allowed roles property. /// </summary> public new hciroles roles; /// <summary> /// checks see if user authenticated , has /// correct role access particular view. /// </summary> /// <param name="httpcontext"></param> /// <returns></returns> protected override bool authorizecore(httpcontextbase httpcontext) { if (httpcontext == null) throw new argumentnullexception("httpcontext"); // make sure user authenticated. if (!httpcontext.user.identity.isauthenticated)

c++ - dynamic_cast of void * -

i need use dynamic cast void* void *target = (myclass*)target;//i storing initially(to implment delegate mechanism) .... delegateclass *delegate = dynamic_cast<delegateclass*>(target); it giving error cannot convert void*, cannot use below code... since delegate mechanism delegateclass *delegate = dynamic_cast<delegateclass*>(((myclass*))target); how type of target , implement... if use typeid() can name of class how use typeid in above equation instead of (((myclass*))target). you cannot use dynamic cast unless original type of variable had vtable (ie, had virtual functions). because dynamic_cast requires run-time type information, recorded in vtable; if vtable missing, compiler doesn't know type object is. you should declare base class virtual destructor, , use pointers base class rather void * .

javascript - move element horyziontally and vertically jquery ui -

this example whit 3 element move horizontally. need move element horizontally , vertically. example if have 3 rows , 3 colums need move element under rows , columns.. please.. html <ul id="sortable"> <li class="ui-state-default" name="a" title="aaaa" ><div id="bbb" title="aaa">item 1</div></li> <li class="ui-state-default" id="b"><div id="bbb" title="aaa">item 2</div></li> <li class="ui-state-default" id="c">item 3</li> <li class="ui-state-default" id="d">item 4</li> <li class="ui-state-default" id="e">item 5</li> </ul> javascript $(function() { $("#sortable").sortable({ revert: true, }); $("#draggable").draggable({ connecttosortable: "#sortable&quo

cocoa - Mac OS X, make a window go over menu bar -

is possible make window go on menu bar, without going in fullscreen? thanks in advance! yes, trivially: window.level = nsmainmenuwindowlevel + 1; (reference: drawing full screen , opengl programming guide mac os x .) sebastianmarkow correct in terrible behaviour normal document window, there several window types normal: cursors, tool tips, , special utilities xscope.

c# - does a code signing certificate help with false positive from a virus scanner -

we have piece of code in c# identified virus avg under it's heuristic behavioral detection. we've been in contact them find out why haven't been responsive. our dll's , exe's signed certificate generated (won't in trusted store) know if purchase code signing cert whether in regards false positive? we purchased code-signing certificate , still got flagged symantec it's no guarantee. in end contacted white-listing service , got our app had checked out , whitelisted. never had deal avg can't comment on process (or lack of).

sql - Query latest data from huge amount of data -

part of work qa data in remote sql servers. , i'm granted query data. everyday, have execute sql scripts query data in each column of every table. these tables holding data collected programs day day. need query data in latest week. since huge amount of data , not fields indexed, of query timeout. does have idea me out? appreciate. use clause on query filters out data last week , request index on columns u want access...

iphone - Queue different commands in cocos2d (CCSequene) -

i'm trying make label fade out screen, after if finished remove view. how queue view waits label faded before removes it? id sequence = [ccsequence actions:[splashlabel runaction:[ccfadeout actionwithduration:0.5]], [self removechild:splashlabel cleanup:yes], nil]; [self runaction:sequence]; id fade=[ccfadeout actionwithduration:1.0f]; id delay=[ccdelaytime actionwithduration:0.2]; id seqq=[ccsequence actions:fade,delay,nil]; [splashlabel runaction:seqq]; id stopani=[splashlabel stopallactions]; id remove=[self removechild:splashlabel cleanup:yes]; [self runaction:[ccsequence actions:stopani,remove,nil]];

c# - WPF ItemsControl:- Changes Property of Items inside ItemControle after ItemSource Property of ItemsControl being changed at Run-Time -

i have following scenario: i have used 1 itemscontrol . which generates button per itemssource given it? now, when hitting nextbutton .[ have mainwindow.xaml ]. the itemssource of itemscontrol (pagecontrol) changes and also have chagne background of button have contents equals currentpage property per scenario. suppose, step 1: in click event of button first change itemssource of itemscontrol . step 2: i change background of particular button. instead of changes in background getting following error. this operation valid on elements have template applied. note:- i don’t have problem if directly changes background without changes in itemssource . have @ below code. mainwindow.xaml <window x:class="currentpageproblem.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" title="mainwindow" he

Collect all names in a column and put them in an Array in Excel -

i pretty new excel , vba , need question. thing have column different names of companies, exampla apple, microsoft, asus.. , companies might used several times. how can populate array in vba contains distinct members of column? you can use vba collection not allow duplicates same key: option explicit sub uniquelist() dim long dim rlist range dim cunique new collection dim afinal() string 'change range depending on size of title (or use named range) set rlist = range("a1:m1") 'loop on every column , add value collection (with unique key) = 1 rlist.columns.count on error resume next cunique.add rlist(1, i), cstr(rlist(1, i)) next 'store value collection array redim afinal(1 cunique.count, 1 1) = 1 cunique.count afinal(i, 1) = cunique(i) next 'use afinal whatever want end sub

jquery - AJAX based page needs repetitive javascript actions -

i'm working on application uses jquery layouts , loads website parts (like gmail). every time load "panel" using jquery have substitute links make work panels (i.e., load link content in panel, not in full page). this: function changemainpane(href) { $("#screen").load(href); $("#screen a.ajax-page").click(function () {return changemainpane($(this).attr("href")) }); } this simplified changemainpane function, mine has tens of $("#screen ...").click() calls integrate new piece of html page. the question is: there better way this? like: $("#screen").ready(function() { // html setups } or "always user clicks on link, check if has ajax-page class , call function" without having initialize each link independently. you can have @ delegate method. delegate method can registered common parent element of links on wants reload main panel. can document object or lower level e

.NET HTML Parser that supports Form posting -

i know there libraries used parse html htmlagilitypack unable find library supports form posting or executing javascript. want post html form windows form application don't want use webbrowser control or mshtml library. there can multiple solutions here because act of creating post request , sending server separate act of parsing , executing javascript. that said, if want create post request, there multiple options in .net, prominent being httpwebrequest / httpwebresponse classes, webclient class, higher level wrapper around httpwebrequest / httpwebresponse . for executing javascript, assumption want execute javascript in page , , while there stand-alone .net javascript parsers/execution engines out there, don't work in page . to end, mshtml library (even though said didn't want use it, imagine on server , have threading/com apartment issues?) choice, , can wrap access sufficiently in .net (although not easily, depending on needs) allow want. if fan

c++ - How can i check network connection on qml? -

i want check if there network connection when app start under splash screen.splash doesnt important, important point how can check network connection in qml? solution can qml, javascript, c++ etc. you can use networkinfo qml element qtmobility.systeminfo 1.1 module. see: http://doc.qt.nokia.com/qtmobility-1.2/qml-networkinfo.html more information.

ASP.NET MVC 3 and JQuery on long-running operations -

i have web-application written on asp.net mvc 3. on client side used jquery. main part of application grid of items. each item has own progress bar , need show realtime progress. unfortunately, need 10 20 seconds fetch data (this pretty difficult process of data aggregation few web-services), need hide process user. thus, have 2 types of operations. first type update operation can called asyncronously (we can inherit asynccontroller , use jquery call operation - sort of long-polling) , second type first load of page. far see, should performed syncroniously, need show loading message. my question simple - how can show such message using jquery while sync data fetching running? thanks! if want roll own, can use following: $('#loadingdiv') .show() // hide .ajaxstop(function() { $(this).remove(); }); there several plugins jquery support modal popups . use 1 of these accomplish same, may overkill.

iphone - Speech to text Conversion.? -

for iphone application need speech text library. can 1 suggest me solution. after 2 days digging found google speech text api , open source openears library. can 1 suggest 1 of these.?which 1 better.? i don't think google apis intended public use. services hosted google android , chrome. people have reversed engineered api , built libraries let people use it, wouldn't build commercial application relied on (unless of course android or chrome application). for iphone, great hope apple expose siri or nuance technology in next os update. there have been rumors no announcements. see http://techcrunch.com/2011/05/06/apple-nuance-ios-siri/ for iphone, know poeple have talked nuance , ispeech , , yapme , others. i'll point different questions more background. there lots, might helpful - text-to-speech (voice generation) , speech-to-text (voice recognition) apis?

javascript - Implementing zoom buttons using d3 -

i trying develop graph visualization webpage using d3, , need provide basic zoom , pan functionality on graph. i saw d3.behaviour.js file see how zoom functionality works. fine far default behavior goes. there way zoom function can called manually, lets attaching zoom , zoom out buttons. zoom behavior in d3 seems tied mouse events. a workaround can manually firing 'mousewheel' (ie/webkit) , 'dommousescroll' (firefox) events when click button. you can see example on how register , dispatch these events here: http://jsfiddle.net/6nnmv/

How can I use the unique(a, 'rows') from MATLAB in Python? -

i'm translating stuff matlab python language. there's command, unique(a), in numpy . since matlab program runs 'rows' command also, gives little different. is there similar command in python or should make algorithm same thing? assuming 2d array stored in usual c order (that is, each row counted array or list within main array; in other words, row-major order), or transpose array beforehand otherwise, like... >>> import numpy np >>> = np.array([[1, 2, 3], [2, 3, 4], [1, 2, 3], [3, 4, 5]]) >>> array([[1, 2, 3], [2, 3, 4], [1, 2, 3], [3, 4, 5]]) >>> np.array([np.array(x) x in set(tuple(x) x in a)]) # or "list(x) x in set[...]" array([[3, 4, 5], [2, 3, 4], [1, 2, 3]]) of course, doesn't work if need unique rows in original order. by way, emulate unique(a, 'columns') , you'd transpose original array, step shown above, , transpose back.

c++ - WinInet HttpQuery Info returning Invalid Status Codes -

i working on program needs check existence of page before loads (so nothing exotic). everything working ok, cannot httpqueryinfo return valid status code page. status code returned is: 1875378224 code producing problem: dword headerbuffsize = sizeof(dword); dword statuscode; //check existance of page (for 404 error) if(!httpqueryinfo(hrequesthandle, http_query_status_code, &statuscode, &headerbuffsize, null)) return 4; if(statuscode == http_status_not_found) cout << "we got 404 error" << endl; cout << "got status code: " << statuscode << endl; //1875378224 everywhere cout << "404 status code: " << http_status_not_found << endl; //what should getting i not sure make of it; have compared own code several examples online, , looks should work, although may have made stupid mistake. thanks! the informa

android - ViewFlipper.addView() gives Exception, while Showing Progress Dialog in AsyncTask -

what want: want show progress dialog while adding views dynamically viewflipper. what have: have used asynctask achieve this. viewflipper declared in main activity, adding views viewflipper in doinbackground() of asynctask. what problem: getting exception on viewflipper.addview() statement , exception " main has leaked window com.android.internal.policy.impl ..... added here. " , this. here code: public class main extends activity { private viewflipper viewflipper; /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main_flipper); viewflipper = (viewflipper)findviewbyid(r.id.id_vf_main); new loaddata().execute(); // other tasks. } class loaddata extends asynctask<object, void, string> { protected progressdialog progressdialog; @override protected void onpreexecute

objective c - Observe property of a custom view from Window Controller in Cocoa KVO -

this hierarchy of application, need observe property: objecta | |-----windowcontrollera (nswindowcontroller) | |-------content(nswindow) | |--------contentview (custom nsview) | |---- propertyx (property observe) i try observe objecta code: [self.windowcontrollera addobserver:self forkeypath:@"self.content.contentview.property" options:nskeyvalueobservingoptionold context:@"context"]; but doesn't work, error : was sent object not kvc-compliant "content" property. what have observe propertyx objecta ? i found problem! this's right path "window.contentview.property"

how to make it work automatically in vb.net? -

do know how work backgroundworker code? the request pulled out of google background worker , if possible collect links google pagination. not in label or how i'm new that. want make go next page 1,2,3,4,5,6,7,8,9 , on clicking button , make go , pick links through pages background worker or timer or how make work automatically said i'm new. google has pagination. goes through 1 page , stop on first number , not move far. thank you. private sub webbrowser1_documentcompleted (byval sender system.object, byval e system.windows.forms.webbrowserdocumentcompletedeventargs) handles webbrowser1.documentcompleted if (webbrowser1.readystate webbrowserreadystate.complete =) each clientcontrol htmlelement in webbrowser1.document.links if not clientcontrol.getattribute ("href"). contains (google) , clientcontrol.getattribute ("href"). contains ("http") , clientcontrol.getattribute ("href"). contains

.net - Convert Func(Of Type, Boolean) to Expression(Of Func(Of Type, Boolean))? -

i've got following code: dim query iqueryable(of someobject) = new objectquery(of someobject)(querystring, db, mergeoption.notracking) .where(ctype(function(x) x.publish = true, expression(of func(of someobject, boolean)))) and gives me error says: cannot convert expression of type func(someobject) system.nullable(of boolean) type system.linq.expressions.expression(of system.func(someobject, boolean)). i have tried: .where(ctype(function(x) x.publish = true, expression(of func(of someobject, nullable(of boolean))))) which doesn't work either. if don't have ctype where comes narrowing conversion error iqueryable , ienumerable, need there, not sure how write parameter expression can converted. help? don't use casting ctype here - create expression directly: dim expr expression(of func(of someobject, nullable(of boolean))) = function(x) x.publish = true dim query iqueryable(

c# - Exception was unhandled - rethrow exception -

i try rethrow exception, it's not working. 'exception unhandled' error in visual studio. public keyvalueconfigurationcollection getmyappsetting() { configuration config; configurationfilemap configfile; try { configfile = new configurationfilemap(configurationmanager.openmachineconfiguration().filepath); config = configurationmanager.openmappedmachineconfiguration(configfile); appsettingssection myappsettingsection = (appsettingssection)config.getsection("xxx/appsettings"); myappsettingsection.sectioninformation.allowexedefinition = configurationallowexedefinition.machinetoroaminguser; return myappsettingsection.settings; } catch (exception ex) { logger.fatal("..."); throw; } } this method belong class library, , call console application. please, me. thanks. it working expected. you catch, rethrow exception - not handling rethrown exception. that's why getting error.

python - lat/lon to utm to lat/lon is extremely flawed, how come? -

i've tried following, input: lat/lon data i'll calculate box around by, let's 50 m, +/- 50 m on easting/northing value. now reconvert lat/lon , script: http://robotics.ai.uiuc.edu/~hyoon24/latlongutmconversion.py result can't be, lon before around 7, afterwards around 2. zone, easting, northing = lltoutm(23, location.get_lat(), location.get_lon()) toputm = northing + error bottomutm = northing - error leftutm = easting - error rightutm = easting + error left, top = utmtoll(23, leftutm, toputm, zone) is error in code, or might script flawed? so i've tried use pyproj, lat/lon utm lat/lon see happens >>> p = pyproj.proj(proj='utm', zone=32, ellps='wgs84') >>> p <pyproj.proj object @ 0x7ff9b8487dd0> >>> x,y = p(47.9941214, 7.8509671) >>> print x,y 5159550.36822 1114087.43925 >>> print p(x,y,inverse=true) (47.971558538495991, 7.8546573140162605) and here it's not extremely far of

c - problem in boolean expression with if statement -

i need confirmation. correct o/p told me following expression not work thanks in advance. #define 11 #define b 12 #define c 13 // want if array[i] has values of of these if( array[i] == (a) ||(b) ||( c)) // function else printf("no match"); replace code this: if( array[i] == || array[i] == b || array[i] == c) each part of boolean condition must complete expression. while wrote valid c code, doesn't achieve want: need make array element comparison in every part.

javascript - Can I duplicate server-side functionality without being able to use server-side tech? -

i have taken position @ large corporation web developer 1 of company's divisions. first task have been asked create web form submits data database , outputs id# of data user reference later. easy, right? unfortunately not. because large company has been around long time systems relatively antiquated , none of servers support server-side technologies (php, asp etc...) , since such large company corporate pretty black hole , there not hope of getting such tech implemented. so! question... there way without server-side? me answer 'no' , have spent last week researching on sites , others without finding miraculous work arounds. have @ disposal things can implement without involving it, things can upload web-server. also note: web server on supposedly ibm web server (ihs) , database supposed connecting ms access database , company restricts using ie web access. form on internal company intranet site ie browser accessed from. i know ridiculous situation unfortunately st

objective c - not deleting cookie (iphone) -

nshttpcookiestorage *storage = [nshttpcookiestorage sharedhttpcookiestorage]; nsarray *cookies = [storage cookiesforurl:[nsurl urlwithstring:@"http://www.facebook.com/"]]; nslog(@"old cookies!: %@",cookies); nshttpcookie *cookie; (cookie in [storage cookies]) { [storage deletecookie:cookie]; } nslog(@"new cookies!: %@",cookies); i trying delete facebook cookie in logout function no cookies deleted. not understand why. appreciated. if want changes nshttpcookiestorage retained, you'll want synchronize standarduserdefaults after modifying cookie store: [[nsuserdefaults standarduserdefaults] synchronize]; to prevent slowing down app, may want call on background thread so: dispatch_queue_t backgroundqueue = dispatch_get_global_queue(dispatch_queue_priority_background, 0); dispatch_async(backgroundqueue, ^{ //todo: cookie deletion logic here }); edit: if need

tsql - How to write SQL query to select percentage with inner join? -

i have 2 table like first table ftid itemname days --------------------------------------- 1 drive 10 2 run 5 3 read 21 second table stid ftid completed (bit) datetime ----------------------------------------------------- 1 1 0 07/11/2011 2 1 1 08/11/2011 3 1 1 09/11/2011 4 1 0 10/11/2011 5 i need select both tables , data can see below itemname days dayscompleted daysincompleted percentagecompletion daysleft --------------------------------------------------------------------------------------- drive 10 2 2 40% 6 select t1.itemname, t1.days, sum(cast(t2.completed integer)) dayscompleted , count(t2

Self-Referencing in Event Listener Delegates (C#) -

this perhaps question of semantics, perhaps not, ask: there appreciable difference in following 2 snippets? public parent() { child newchild = new child(); newchild.requestspecialevent += (sender, e) => { newchild.domagic(); } } or public parent() { child newchild = new child(); newchild.requestspecialevent += (sender, e) => { ((child)sender).domagic(); } } obvious difference option 1 sort of self-references itself, while option 2 performs cast on object. performance wise, expect cast more expensive. however, i'm theorizing in option 1, technically "parent" holds reference "newchild" (through delegate defined within parent), if newchild goes away (newchild = null or similar), newchild object can't garbage collected (gc'ed) because parent has defined delegate still attached it. newchild can gc'ed when parent goes away. however, in option 2, parent never creates such "hard refer

c++ - vector<float>* causing seg fault! -

i have vector of floats, defined by: std::vector<float>* myvec; and filling inside loop later with: myvec->push_back(somevalue) and getting seg fault. in order try , find out going on commented out push_back line , still saw seg fault, , when seg faulted size of myvec 490618047. is there perhaps have forgotten vector, , how getting filled such huge number without entries being entered vector? thanks in advance. you've not allocated memory: std::vector<float>* myvec = new std::vector<float>(); because myvec pointer std::vector<float> , you've above, before using myvec . also, don't forget deallocate memory, once you're done myvec : delete myvec; apart that, i think , don't need pointer begin with; if so, should following instead of declaring pointer: std::vector<float> myvec; //it not pointer. and use as: myvec.push_back(somefloatvalue);

asp.net mvc 3 - Annotating properties on a model with default values -

i created ef4.1 code-first model (may or may not important), , i'm trying default values create scaffold template. model looks like: class person { [defaultvalue (18)] public int age { get; set; } } and create view looks like: <div class="editor-label"> @html.labelfor(model => model.age) </div> <div class="editor-field"> @html.editorfor(model => model.age) @html.validationmessagefor(model => model.age) </div> i expect @ runtime, editorfor pre-populate textbox "18", no such thing. misunderstanding defaultvalue attribute for, or there else should doing? note: don't want use new { value = "18" } override on editorfor method, seems break dry. i don't know if satisfy dry needs, it's start think. i rework model bit this: public class person { private const int default_age = 18; private int _age = default_age; [defaultvalue(default_age)] pu

php - Fatal error: Call to undefined function get_all_subjects() in -

i trying teach myself php & mysql. please note new this. below error message getting , code. i hope makes sense!!! fatal error: call undefined function get_all_subjects() in /users/darren/sites/widget_corp/content.php on line 9 content.php code <?php require_once("includes/connection.php"); ?> <?php require_once("includes/functions.php"); ?> <?php include("includes/header.php"); ?> <table id="structure"> <tr> <td id="navigation"> <ul class="subjects"> <?php $subject_set = get_all_subjects(); **// problem line** while ($subject = mysql_fetch_array($subject_set)) { echo "<li><a href=\"content.php?subj=" . urlencode($subject["id"]) . "\">{$subject["menu_name"]}</a></li>"; $page_set = get_pages_for_subject($subject["id"]); echo "<ul class=\"pages\">"; while

php - How to store a javascript widget which has analytics? Dynamic or static? -

i have widget provide boot loader put on website. bootloader file gets settings widget , creates widget. content of bootloader file doesn't change unless widget edited, means of times bootloader file has static content. however right bootloader file created dynamically every request. save settings widget in database , serve file. size of file 6kb. wondering better: save data in database , serve bootloader file dynamically, save data in static javascript file or store data in database , store data in javascript file (this allows later updates in corrupted javascript files) also, wondered if stored static js file .js.gz (compressed) , .js(uncompressed) how serve uncompressed file when browser not support compressed file...could same done if dynamic bootloader file used. the bootloader file used json content processed bootloader file , displayed, means bootloader file better if cached prevent getting js on , on again. so ->how should file stored? ->how difference in

Interview question: Honeypots and web crawlers -

i reading book prep interview , came across following question: what when crawler runs honey pot generates infinite subgraph wander about? i wanted solutions qn. personally, form of depth limited search prevent traversing continuously. or perhaps use form of machine learning detect patterns. thoughts? most commonly infinite subgraphs prevented link depth. gain inital set of urls , traverse each finite depth. while limiting traversing depth may use heuristics dynamically adjust according webpage characteristics. more information can found e.g. here . another option try sort of pattern matching. depending on algorithm produces subgraph pretty (very very)hard task. @ least pretty expensive operation. for interview question(about detecting infinite loops): if ask questiom want hear reference halting problem alan turing proved in 1936 general algorithm solve halting problem possible program-input pairs cannot exist.