Posts

Showing posts from June, 2013

doctrine2 - Doctrine ORM Conditional Association -

doctrine2 - Doctrine ORM Conditional Association - i'm building q&a site , questions, answers , comments on same posts table. posttype different. can answers question , comments reply association: /** * @onetomany(targetentity="cms\entity\post", mappedby="parent") */ private $answers; /** * @onetomany(targetentity="cms\entity\post", mappedby="parent") */ private $comments; but think not right way because if fetch question both answers , comments filling answers. have set status relation posttype = 1 how can this? your schema invalid. schould have 2 different objects answers , comments 2 different things, if share mutual interface. you should create 2 entities, answer , comment , create assocations them. same thing create abstract class, abstractcontent , defines required fields , accessor methods. doctrine supports inheritance final database schema same, oo model correct. /** * @mappedsuperclass *...

mysql - Hibernate mapping doesn't allow null timestamp -

mysql - Hibernate mapping doesn't allow null timestamp - i developing web based application using spring-hibernate combination mysql database. have observed 1 problem hibernate mapping doesn't allow me set null, when type timestamp. here code snippet improve understanding here agenda - want allow user come in null value endtime, not sttime. schedule.htm.xml <id name="id" type="long" column="test_run_schedule_id" > <generator class="increment" /> </id> <property name="testname" type="java.lang.string" column="test_run_name" not-null="true" length="45" /> <property name="operation" type="java.lang.string" column="operation_included" not-null="true" length="500" /> <property name="sttime" type="java.util.date...

android - onLocationChanged call the onDraw method in my custom view -

android - onLocationChanged call the onDraw method in my custom view - i have mapimageviewer activity class has methods checking phones gps location. activity calls custom view of mine called mapcanvas - constructor takes latitude , longitude , draws circle corresponding pixels on image of map. this works ok, wondering how can update , phone call ondraw method every time gps coordinates change? know needs go in onlocationchanged method..but i'm not sure how can pass new latitude , longitude values there custom view class. what sending lat/lon onlocationchanged() method using .sendbroadcast() , handle them within view class broadcastreceiver ? alternatively utilize callback method locationlistener shown in this post. android view android-canvas draw

asp.net - add an initial line-through text-decoration on a label in a asp listview -

asp.net - add an initial line-through text-decoration on a label in a asp listview - my goal display list of tasks checkboxes. checking checkbox task update display of task line-through text decoration appear. everythign working great, except can't figure out how show list of tasks line-through if completed, or normal if task not completed. here's code excerpts: <asp:listview .../> ... <itemtemplate> <asp:hiddenfield id="taskcompleted" runat="server" value='<%#bind("taskcompleted")%>'/ <asp:checkbox id="completedcheckbox" runat="server" autopostback="true" oncheckedchanged="completedcheckboxchange" checked='<%#iif(eval("taskcompleted"), "true", "false")%>' /> <asp:label id="tasklabel" text='<%#eval("taskdesc")%>' runat="server" /> </itemtemplate> ... ...

ruby on rails 3 - Active Record Querying belong_to -

ruby on rails 3 - Active Record Querying belong_to - i have 2 next models associated: class post < activerecord::base belongs_to :language end class language < activerecord::base has_many :posts end from view have link filter posts language: <div id="english"><%= link_to "english", {:controller => 'posts', :action => 'search_result', :language => "english"} %></div> the model language has variable name:string 1 using create active record query. the uncertainty have how can create query post controller retrieve right posts has field: language.name == "english". i tried this: @posts = post.all(:conditions => ["language.name = ?", params[:language]]) and this: @posts = post.where(:language.name => params[:language]) hope have explained issue, quite newbie yet. ah! know improve in case use: "all" or "where" ??. lot in advan...

android - Is it possible to know at runtime when Garbage collection is occuring? -

android - Is it possible to know at runtime when Garbage collection is occuring? - basically, using achartengine charting application. seems have memory leak somewhere garbage collection occuring often. problem is, whenever gc occurs, messes chart. can phone call repaint() prepare it, need know when gc. image of messed chart below [url=http://img166.imagevenue.com/img.php?image=403999439_device_2011_07_11_122608_122_441lo.png][img]http://img166.imagevenue.com/loc441/th_403999439_device_2011_07_11_122608_122_441lo.png[/img][/url] each java object have method finalize() called before gc seek "delete" object. example hope help. android garbage-collection

c# - How to Create a Switch Topology Page using ASP.NET -

c# - How to Create a Switch Topology Page using ASP.NET - i developing website network need help.. lets consider, have 10 switch, in same brand (cisco 3560) in local area network topology , switches have management ip addresses, such as; 10.1.1.8,10.1.1.9..., requirements: when default page opened; website scan(discover) active switches , managements ip addresses. after find operation completed; bring (draw) switch images , physical connections, webpage in packet tracer network program. the platforms using are, c#, asp.net, visual studio. i don't know start! how find switches , how find libraries draw diagrams of discovered switches. i believe utilize snmp observe network-connected devices managable. there's limited built-in back upwards in bcl; think 3rd party libraries may improve route; http://sharpsnmplib.codeplex.com/ c# asp.net visual-studio-2010

F# tail recursion stack overflows when not run locally -

F# tail recursion stack overflows when not run locally - i having problems running below recursive function on our development web server. causes stack overflow. runs fine locally when in debugging mode. here things have tried: made sure 'generate tail calls' enabled under build options. i ran disassembler , followed instructions here: http://blogs.msdn.com/b/fsharpteam/archive/2011/07/08/tail-calls-in-fsharp.aspx , not appear using tail recursion. i've tried rewriting without using recursion f# skills not best. so questions be: is function going able utilize tail end recursions? why work locally in debugging mode through vs not on dev web server? thanks! let rec simulationloop (rownum : int) (h : double) (time : double) (v : double) (s : double) (p : double) (newv' : double) (news' : double) (newp' : double) (designparameters : designparameters) (inputs : isimulationinputprovider) = seq { //let timer = system.diagnostics.stopwatch.startne...

timestamp - Why can't I use Current_timestamp as default value in mysql? -

timestamp - Why can't I use Current_timestamp as default value in mysql? - i has mysql database set locally phpmyadmin. wanted utilize available tables in remote database, exported sql phpmyadmin , tried run on other db. this export gave me: create table if not exists `messages` ( `id` int(11) not null auto_increment, `title` varchar(255) not null, `message` text not null, `msgtype` varchar(10) default null, `important` int(1) not null default '0', `poster` int(5) default null, `date` timestamp not null default current_timestamp, primary key (`id`) ) engine=myisam default charset=latin1 auto_increment=37 ; however, complains there parse error near 'current_timestamp, primary key ( id ) ) engine=myisam defa". it worked on local db, why not here? changed , how prepare it? edit: i've tried using other functions now() or curdate() well, same problem. from the documentation: note in older versions of mysql (prior...

xcodebuild - Xcode source code directory -

xcodebuild - Xcode source code directory - goodday! todo: compile files directory outside of xcode project. how tell xcode path source codes compile (like vpath in makefile)? note1: right-click target , easy add together search path header files or lib, there havent found alternative add together new source code directory. note2: havnt found reply in xcode build documentation issue. p.s.: hope can without copying files xcode explicitly. thank you! drag directory containing files xcode project. way xcode knows needs compile files if contained in project , part of target. xcode xcodebuild

C# How to save image from an OLE Object stored in a Database -

C# How to save image from an OLE Object stored in a Database - it seems header bytes stored along image when embedded access database ole object , preventing me writing bytes stored disc raises exception 'a generic error occurred in gdi+.' how extract image bytes ole object stored in access database , save disk? photo = ((rs.fields["photo"].value == system.dbnull.value) ? null : (byte[])rs.fields["photo"].value) ... if (photo != null) { memorystream stream = new memorystream(photo); image image = new bitmap(stream); stream.close(); image.save(@"c:\temp\images\test", imageformat.jpeg); } using (memorystream stream = new memorystream(photo)) using (image image = image.fromstream(stream)) { image.save(@"c:\temp\images\test.jpg", imageformat.jpeg); } c# image ms-access

sql server - Update a table using CTE and NEWID() -

sql server - Update a table using CTE and NEWID() - i want seek update table using random values same table, original table don´t have identity follow or other number column... with ctetable1 ( select row_number() on (order newid()) n, ende_no_address tablex ) update tablex set ende_no_address = ( select ende_no_address ctetable1 ctetable1.n = problem... tnks help declare @t table(col1 varchar(10)) insert @t values (1),(2),(3),(4),(5) ;with cte ( select *, row_number() over(order newid()) rn1, row_number() over(order col1) rn2 @t ) update c1 set col1 = c2.col1 cte c1 inner bring together cte c2 on c1.rn1 = c2.rn2 edit: with cte ( select row_number() on (order newid()) n1, row_number() on (order (select 1)) n2, ende_no_address tablex ) update c1 set ende_no_address = c2.ende_no_address cte c1 inner bring together cte c2 on c1.n1 = c2.n2 sql-server random common-table-expression

c# - Generic Type contraints with Or -

c# - Generic Type contraints with Or - public t createform<t>() t: baseform, basemainform i know above means t baseform and basemainform . possible create constraint t has either baseform or basemainform ? no, not allowed in c#. compiler uses generic constraint determine operations available on t within generic method - allowing or look not type safe. if need this, consider adding interface covering mutual parts of baseform , basemainform , , apply generic constraint. way, interface defines contract of method createform<t> needs - , must create sure form's pass in implement interface. something like: public interface ibaseform { foo(); } class baseform : ibaseform {} class basemainform : ibaseform {} public t createform<t>() t : ibaseform c# constraints generics

.net - FTP fileupload with progress -

.net - FTP fileupload with progress - i'm going write ftp client using .net framework. want upload files , show how many bytes (or kilobytes) uploaded. i've been looking way of uploading file on ftp monitoring progress of them using libraries. is there way of uploading on ftp , observing process using standard .net features? if yes, grateful code snippet. you can utilize webclient that. register uploadprogresschanged , uploadfilecompleted events , upload file using uploadfileasync() . .net ftp

c# - OnApplyTemplate method does not get called when the custom control is being rendered -

c# - OnApplyTemplate method does not get called when the custom control is being rendered - i have made custom command windows phone 7. if utilize command in xaml code, shows in both designer , emulator. but if create in c# code , render in writeablebitmap, nil shows in writeablebitmap, , onapplytemplate not called either. i tried calling applytemplate method , measure , arrange methods, none of them can create command rendered. so right approach create custom command renderable in writeablebitmap? thanks. before wpf template applied, includes silverlight, object must added visual tree. calling applytemplate fail if object isn't in visual tree. create render properly, add together visual tree, can phone call applytemplate / updatelayout / etc. , have render correctly. c# silverlight xaml windows-phone-7 custom-controls

jquery - javascript looping through array and accessing key : value -

jquery - javascript looping through array and accessing key : value - i've looked through quite few questions can't figure out: i strugling js. i have config array form field character counter, like: var charwatch = [ {key: 'headline', value: 60}, {key: 'subheading', value: 40} ]; it represents id's of fields want watch, along corresponding max character counts. the actual character counter / limiter works fine - problem having providing above info it. i trying loop through config , execute function in each loop, passing key , value each time. for(p in charwatch) { element = charwatch[p].key; jq-element = '#'+element; count = charwatch[p].value; $(jq-element).keyup(function() { check_max_chars(element, count); // external function console.log(element); }); } it's kind of working, finding console.log(element) (in .keyup function) "subheading", never "heading". works should ...

asp.net - C# OpenPOP index -

asp.net - C# OpenPOP index - i using openpop library gmail. issue emails not in order received. pop3 = new pop3client(); pop3.connect("pop.gmail.com", 995, true); pop3.authenticate("test@gmail.com", "test", authenticationmethod.usernameandpassword); emailamount = pop3.getmessagesizes().count; (int = 1; < emailamount; i++) { tempmessage = pop3.getmessage(i); tbstatus.text = asciiencoding.ascii.getstring(tempmessage.rawmessage); } pop3.disconnect(); pop3.dispose(); the emails received scattered. why , how can resolve it? as far recall (and it's been while since read rfc-1939), pop3 server has no obligation list messages in particular order @ all. so, if care processing messages in order received, it'll sort them order before processing them. c# asp.net email pop3

java - make my SOAP web service consumed in local network -

java - make my SOAP web service consumed in local network - i'm using netbeans 7.0 , create soap webservice , create java applet consume webservice , works fine after had signed applet....all works fine in localhost, when tried consume web service through local network nil happened , webservice failed consume..i'm sure miss thing , must configure web service wsdl run in local network don't know steps , how that. i tried effort alter addresses in jax-ws-catalog local network address <?xml version="1.0" encoding="utf-8" standalone="no"?> in 192.168.1.8 local network address , 8080 port, don't if i'm acting right way , hope can done in wizard through netbeans can consume webservice through local network, glad if 1 can give me steps or useful links or threads discuss issue thanks, which interface web service listening on. enter "netstat -a" command , see listening ...

java - OOP Inheritance question -

java - OOP Inheritance question - is next scenario possible: create object pool of animal , called animalpool allocate animal object (called myanimal ) animalpool cast myanimal cat set cat -specific field store myanimal array of animal (say @ index 0) later access array, , cast index 0 cat , check field set in 4. i think can you're trying do, not way you're thinking of doing it. animalpool going animal "factory" (look mill pattern, may help, it's not of import part here.), , double collection of "animals". create "animal" object, has methods , properties mutual across animals. create animals need such "cat" , "dog" , derive them base of operations class of "animal". in "animalpool", add together functions create , homecoming specific types of animal, such getdog() , getcat(), or create 1 function parameter. create specific type animalpool factory, , because derives ...

Is NoSQL 100% ACID 100% of the time? -

Is NoSQL 100% ACID 100% of the time? - quoting: http://gigaom.com/cloud/facebook-trapped-in-mysql-fate-worse-than-death/ there have been various attempts overcome sql’s performance , scalability problems, including buzzworthy nosql motion burst onto scene couple of years ago. however, discovered while nosql might faster , scale better, did @ expense of acid consistency. wait - reading wrongly? does mean if utilize nosql, can expect transactions corrupted (albeit daresay @ low percentage)? it's true , yet bit false. it's not corruption it's seeing different during (limited) period. the real thing here cap theorem states can take 2 of next three: consistency (all nodes see same info @ same time) availability (a guarantee every request receives response whether successful or failed) partition tolerance (the scheme continues operate despite arbitrary message loss) the traditional sql systems take drop "partition tolera...

wpf - How do I bind combobox text to legacy data not in the drop down list? -

wpf - How do I bind combobox text to legacy data not in the drop down list? - the drop-down list (itemssource) of combobox contains new product request items. i want bind legacy info not in drop-down list. complicate things i'm using multibinding imultivalueconverter combine fields display. also, names of bound fields not match names of properties i'm bound to. the combobox itemssource list of newproductrequests. npr object newprodnumber , newprodname combined display in drop-down list type converter. convertback method returns values newprodnumber , newprodnumbercombinedwithname. these 2 values saved database fields different names. illustration i'll phone call them dbprodrequestnumber , dbprodrequesttitle. i've succeeded in displaying , saving new items. the problem haven't figured out how display legacy info not in list. it's not in list because no longer qualifies new product request. here problem xaml (the itemssource set in code-behind): ...

ruby on rails - ActionController::RoutingError (No route matches "/users"): -

ruby on rails - ActionController::RoutingError (No route matches "/users"): - i'm using rails 3 + devise. when user signs , there error. app redirecting to: http://localhost:3000/users showing error messages, in log see following: started post "/users" 127.0.0.1 @ mon jul 11 20:22:19 -0700 2011 processing registrationscontroller#create html parameters: {"commit"=>"create account", "fb_access_token"=>"xxxxx", "authenticity_token"=>"fwd/xxxx=", "utf8"=>"✓", "user"=>{"remember_me"=>"0", "lname"=>"xxxx", "fname"=>"xxxx", "password"=>"[filtered]", "email"=>"xxxx-inc.com"}, "fb_uuid"=>"312312"} sql (0.1ms) begin user load (0.2ms) select "users"."id" "users" ("users"....

java - How to stop a running thread under following condition in ANDROID -

java - How to stop a running thread under following condition in ANDROID - in app when user clicks on spell button play sound read outs letters of word displaying each letters. implemented successfully!. and used swipe gesture alter word. if user swipes screen word should displayed. , implemented successfully!! problem: while sound playing if user swipes sound should stop , next word shold displayed.(i guess running thread should stopped). how can that? solution? code outlines: public class birdsactivity extends activity implements onclicklistener{ //on createmethod*(){ . . //on spell button click run thread play sound , draw text new drawletter("alphakids").start(); // initiate gesture detection } class drawletter extends thread { string tempname=names[position]; string b=""; int i=0; public drawletter(string str) { super(str); } public void run() { (int = 0; < names[position].leng...

read facebook rss in Flash (cross domain) -

read facebook rss in Flash (cross domain) - i building application fetches next rss feed , displays it. http://www.facebook.com/feeds/page.php?id=94572408519&format=rss20 works fine locally when uplaod swf online stops working. added crossdomain policy file , doesn't help. odd thing twitter feed loading fine (both locally , online) ideas? code: override protected function initcontent():void { super.initcontent(); security.allowdomain("https://facebook.com") setcontent("loading data..."); var req:urlrequest = new urlrequest("https://facebook.com/feeds/page.php?id=94572408519&format=rss20"); var l:urlloader = new urlloader(); l.addeventlistener(event.complete, oncontentload); l.addeventlistener(ioerrorevent.io_error, oncontentloaderr); l.load(req); } private function oncontentload(event:event):void { var loadedxml:xml = new xml(event.target.data); //...

string - Subsetting in R, joining and calculating multiple repetitions -

string - Subsetting in R, joining and calculating multiple repetitions - here sample: > tmp label value1 value2 1 aa_x_x xx xx 2 bc_x_x xx xx 3 aa_x_x xx xx 4 bc_x_x xx xx how calculate median of repeated labels (or more, of corresponding values in other info frame columns), taking business relationship first 2 letters (ie. "aa_1_1" , "aa_s_3" same values)? list of labels finite , usable. i have read aggregate , %in% , subset , substr , unable compile useful , simple. here hope get: > tmp.result label median1 some.calculation2 1 aa xx xx 2 bc xx xx 3 aa xx xx 4 bc xx xx thank much. have tried making new info frame--i'll phone call tmp2 --where tmp2$label==substr(tmp$label,0,2) ? there, can, example, utilize tapply(tmp2$value1,tmp2$label,mean) average values of value1 aggregated on tmp2$label . an alternative using dplyr ...

c# - How can I impersonate logged on user and get access to unc folders? -

c# - How can I impersonate logged on user and get access to unc folders? - i'm having problem impersonating logged on user , access unc files. have tried using sample code: using system.security.principal; ... // obtain authenticated user's identity windowsidentity winid = (windowsidentity)httpcontext.current.user.identity; windowsimpersonationcontext ctx = null; seek { // start impersonating ctx = winid.impersonate(); // impersonating // access resources using identity of authenticated user } // prevent exceptions propagating catch{} { // revert impersonation if (ctx != null) ctx.undo(); } // running under default asp.net process identity if seek access file locally comment says access resources using identity of authenticated user works should. if seek same thing file on file server somewhere using unc \\servername\share\filename.txt doesn't matter impersonated business relationship has plenty rights. applic...

c# - nservicebus startup error -

c# - nservicebus startup error - i'm trying , running nservicebus setup. i'm trying re-create of asyncpages sample project. in commandserver project have next config: <msmqtransportconfig inputqueue="sonatribeinputqueue" errorqueue="error" numberofworkerthreads="1" maxretries="5" /> i have next message endpoint: public class messageendpoint : iconfigurethisendpoint, asa_server, iwantcustominitialization { /// <summary> /// perform initialization logic. /// </summary> public void init() { console.writeline("configuring persistence..."); var container = new windsorcontainer(); container.install(fromassembly.indirectory(new assemblyfilter(assembly.getexecutingassembly().location, "commandserver.*.dll"))); configure.with() .castlewindsorbuilder(container).binary...

perl - Google app engine receiving audio binary stream -

perl - Google app engine receiving audio binary stream - update after answer: code fixed , works below right code im trying post perl script (on server) google app engine, , im not sure how go doing on google app engine side. this perl script testing : my $audio = `cat audiotest.flac`; $url = "http://app.appspot.com/mainpage" #this not real url $ua = lwp::useragent->new; $response = $ua->post($url, content_type => "audio/x-flac; rate=16000", content => $audio); if ($response->is_success) { print $response->content; } so how send flac binary stream, question how google app engine receive , it. im attempting in python (but code not right , / or doesnt create sense) class mainpage(webapp.requesthandler): def post(self): destinationurl = "http://www.google.com/speech-api/v1/recognize?xjerr=1&client=chromium&lang=en-us" result = urlfetch.fetch(url=destinationurl, payload= self.request.body, method=urlfet...

android - Images in SimpleCursorAdapter -

android - Images in SimpleCursorAdapter - i'm trying utilize simplecursoradapter viewbinder image database , set listview item view. here code: private void setupviews() { mnewsview = (listview) findviewbyid(r.id.news_list); cursor cursor = getnews(); simplecursoradapter curadapter = new simplecursoradapter( getapplicationcontext(), r.layout.cursor_item, cursor, new string[] { "title", "content", "image" }, new int[] { r.id.cursor_title, r.id.cursor_content, r.id.news_image }); viewbinder viewbinder = new viewbinder() { public boolean setviewvalue(view view, cursor cursor, int columnindex) { imageview image = (imageview) view; byte[] bytearr = cursor.getblob(columnindex); image.setimagebitmap(bitmapfactory.decodebytearray(bytearr, 0, bytearr.length)); homecoming true; } }; i...

Cygwin Commands from Web Service ASP.NET C# -

Cygwin Commands from Web Service ASP.NET C# - i want execute cygwin command within webservice. basically want utilize "tail" command strip off first line of file in c#. can help. urgent calling programme strip first line of file sounds bad idea. might want seek , strip first line in c#. c# asp.net cygwin process.start

osx - 6g: No such file or directory - Building Go packages with `gomake` on Snow Leopard -

osx - 6g: No such file or directory - Building Go packages with `gomake` on Snow Leopard - i have 2 .go files, numbers.go , numbers_test.go , want build , execute tests per creating new bundle tutorial (scroll downwards details on files.) files in same directory. when navigate directory in terminal , type gomake this: 6g -o _go_.6 numbers.go make: 6g: no such file or directory make: *** [_go_.6] error 1 this error saying cannot find numbers.go . if manually execute line (without moving directory): 6g -o _go_.6 numbers.go it creates _go_.6 file. why can't gomake find file? here files using: numbers.go looks this: package numbers func double(i int) int { homecoming * 2 } numbers_test.go looks this: package numbers import ( "testing" ) type doubletest struct { in, out int } var doubletests = []doubletest{ doubletest{1, 2}, doubletest{2, 4}, doubletest{-5, -10}, } func testdouble(t *testing.t) { _,...

c++ - Which technique for breaking out of a 'visitor' loop is easier for compilers to analyze? -

c++ - Which technique for breaking out of a 'visitor' loop is easier for compilers to analyze? - i'm generating code intended c++ compiler. i'm generating class take visitor object, phone call take method on several objects. however, want visitor have ability 'break', is, visitor should have way of indicating wants stop rest of take calls because lost interest. i see 2 ways accomplish this, , assuming compiler has total visibility of dispatching class methods , visitor's methods (so inlining possible), i'm curious way easier compiler optimize. obviously, different compilers produce different results, i'd code generator produce code that requires to the lowest degree amount of sophistication compiler produce fast code. the first way generate dovisiting method expects take method on visitor indicating whether should continue: template<class visitort> void dovisiting(visitort& visitor) { if(visitor.accept(object1)) { ...

php - i want to pagination in my class use diffent function -

php - i want to pagination in my class use diffent function - (note: first language not english) i want pagination new function in class. what can do? i using function list books. public function katkitapcek($columns,$category,$limit,$sayfa) { $columns = mysql_real_escape_string($columns); $category = mysql_real_escape_string($category); $limit = mysql_real_escape_string($limit); $page = mysql_real_escape_string($page); $limit0 = $limit * $sayfa; $limit1 = ($sayfa-1) * $limit; $sql = "select " . $colums . " kitaplar k_kat = '$category' limit " . $limit1 . "," . $limit0 . " order k_id asc "; $query = mysql_query($sql,parent::baglandb()); if ($query) { homecoming true; } else { homecoming false; } php oop class pagination

wordpress - Implementing XMLRPC -

wordpress - Implementing XMLRPC - i'm developing custom blog scheme wordpress. the problem didn't understand <link rel="pingback" href="http://localhost/wordpress/xmlrpc.php" /> for, , whether necessary improve page rank. if necessary, possible implement in custom website? how? thanks. xml-rpc way send info (as xml files) wordpress. illustration remotely publish posts using offline blog editor. personally don't think useful , it's not necessary. wordpress xml-rpc

contextmenu - How to add custimized context menu item on right click in browser window? -

contextmenu - How to add custimized context menu item on right click in browser window? - here want add together custom menu alternative i.e. colorzilla, aptana studio on web browser right click you can browser plugin. each browser have own syntax plugins , adding context menu items. browser contextmenu custom-contextmenu

layout - Android Graphics Making Line/Bar Graphs -

layout - Android Graphics Making Line/Bar Graphs - i need create graph page of android app creating. have looked everywhere on line, can't find tutorial graphics , graphing? , don't want utilize else's code. what methods supposed utilize inorder create proper layout lets line graph? can recommend tutorial making graph usefull? thank in advance you can utilize library chartdroid without having worry copyright mess. otherwise go here tutorial might help write own. android layout graphics graph

sql server - Hibernate - Parameter value [2011] was not matching type [java.lang.Integer]. How to solve? -

sql server - Hibernate - Parameter value [2011] was not matching type [java.lang.Integer]. How to solve? - i getting message above though value i'm passing through integer named query. can explain why? thanks dao java code calendar cal = calendar.getinstance(); cal.settime(interval.getstartdate());         query.setparameter("academicyear", new integer(cal.get(calendar.year))); query: @namedquery(name = "studentdemographics.findbymoedequal", query = "select s.student studentdemographics s " +     "where :academicyear = s.academicyear " +        "and upper(s.moed) :moed"), error: parameter value [2011] not matching type [java.lang.integer] environment spring w hibernate/jql + sql server i had similar problem , prepare way: i used long instead of int type respective field. java sql-server hibernate jql

javascript - Clock on webpage using server and system time? -

javascript - Clock on webpage using server and system time? - i need add together clock web page. clock needs synchronized server don't want have check server page open 24/7 on several pcs. there way time server , utilize systems clock maintain updated , check server every 15 minutes or maintain synced? the way i've gone before is: take time server, take time client (immediately) get offset. when showing clock, apply offset current time on client. you need update server. the problem you've got sort out though in making request time server, there lag before can client time. can minimize using ajax request server time , nil else, thereby cutting overhead , network lag etc. javascript ajax vb.net clock clock-synchronization

git - Detach subdirectory (that was renamed!) into a new repo -

git - Detach subdirectory (that was renamed!) into a new repo - i have repository , detach 1 of directories new repo. this perfect place started, there 1 caveat, however: directory want detach renamed @ point. , if follow solution post new name of directory seems i'm loosing history before re-name. ideas of tweak create work in situation? git filter-branch can operate on ranges of commits; can filter 'before' , 'after' separately, , utilize grafts tack them together: git branch rename $commit_id_of_rename git branch pre-rename rename~ ## first filter commits rename, not rename git filter-branch --subdirectory-filter $oldname pre-rename ## add together graft, our rename rev comes after processed pre-rename revs echo `git rev-parse rename` `git rev-parse pre-rename` >> .git/info/grafts ## first filter-branch left refs backup directory. move away ## next filter-branch doesn't complain mv .git/refs/original .git/refs/original0 ## filter res...

Jquery Date picker Default Date -

Jquery Date picker Default Date - i using jquery datepicker in project. problem is not loading current date, showing date 1st jan 2001 default. can please allow me know how default date can corrected display current date. intesting, datepicker default date current date found, but can set date by $("#yourinput").datepicker( "setdate" , "7/11/2011" ); don't forget check scheme date :) jquery jquery-ui datepicker jquery-ui-datepicker

Calculating SHA2 checksum on string in ABAP -

Calculating SHA2 checksum on string in ABAP - i trying calculate sha2 checksum on string in abap. have come across functions calculate_hash_for_char , calculate_hmac_for_char. however, calculate_hash_for_char can calculate sha1 (entering sha2 returns nothing). by contrast, calculate_hmac_for_char seems rely on entries maintained in securestorage, not helpful me (and i'm not sure give me results need). also, after seeing how fm ssfh_f4_hashalg returns possible values hash algorithms, seems possible values dependent on version of sapseculib have installed. any ideas how else can calculate sha2 hash in abap? ok, seems reply utilize class cl_abap_message_digest (and specify sha256 algorithm). info in note 1410294 (support sha2-family message digest , hmac) , requires kernel patch level etc. abap

windows - Use the python interpreter packaged with py2exe -

windows - Use the python interpreter packaged with py2exe - hi guys first question on stackoverflow , unfortunately it's unusual one. i have python script want distribute windows, people might not have python installed. utilize py2exe. problem in script run other python scripts using subprocess, requires python interpreter programme execute. don't have python interpreter installed on windows, there way ignore interpreter , work around problem? there way phone call python interpreter pakcaged py2exe? it's more simple think: instead of starting sub-processes, utilize built-in eval() command execute scripts. [edit] redirect stdio, replace sys.stdout/sys.stderr buffers or else supports "write()". to restore original values, sys module offers __stdout__ , etc. [edit2] haven't tried might work: add together "python.exe" set of files py2exe creates. from main code, re-create files py2exe created + python.exe temporary direct...

c++ - How can I find out how many bytes are available from a std::istream? -

c++ - How can I find out how many bytes are available from a std::istream? - if wanted read() content of std::istream in buffer, have find out how much info available first know how big create buffer. , number of available bytes istream, doing this: std::streamsize available( std::istream &is ) { std::streampos pos = is.tellg(); is.seekg( 0, std::ios::end ); std::streamsize len = is.tellg() - pos; is.seekg( pos ); homecoming len; } and similarly, since std::istream::eof() isn't useful fundtion afaict, find out if istream 's pointer @ end of stream, i'm doing this: bool at_eof( std::istream &is ) { homecoming available( ) == 0; } my question: is there improve way of getting number of available bytes istream ? if not in standard library, in boost, perhaps? for std::cin don't need worry buffering because buffered --- , can't predict how many keys user strokes. for opened binary std::ifstream , buffere...

c# - Proper way to use LINQ with CancellationToken -

c# - Proper way to use LINQ with CancellationToken - i trying write linq query back upwards cancellation using cancellationtoken mechanism provided in .net framework. however, it's unclear proper way combine cancellation , linq be. with plinq, it's possible write: var resultsequence = sourcesequence.asparallel() .withcancellation(cancellationtoken) .select(myexpensiveprojectionfunction) .tolist(); unfortunately, withcancellation() applies parallelenumerable - can't used plain old linq query. it's possible, of course, utilize withdegreeofparallelism(1) turn parallel query sequential 1 - hack: var resultsequence = sourcesequence.asparallel() .withdegreeofparallelism(1) .withcancellation(cancellationtoken) .select(myexpensiveprojectionf...

javascript - Does Internet Explorer support arguments.callee.name? -

javascript - Does Internet Explorer support arguments.callee.name? - i know can name of current running function using arguments.callee.caller.name but not work in internet explorer (any version). what's right cross-browser syntax? workaround exist? apart fact arguments.callee beingness phased out , absent in ecmascript 5 strict mode, main issue function objects in ie not have name property. implemented in browsers, notably firefox , recent webkit-based browsers, non-standard, , indeed there no standardized way hold of function name. the alternative leaves trying parse name function's string representation, not idea. there's (long) give-and-take here it: http://groups.google.com/group/comp.lang.javascript/browse_frm/thread/b85dfb2f2006c9f0. javascript jquery javascript-events cross-browser mootools

Android: pixel quality reduction in Images loaded in WebView -

Android: pixel quality reduction in Images loaded in WebView - i building javascript application mobile browsers (not wrapped-as-native app). i noticed android (tested 2.3 emulator , galaxy s device) reduces quality of loaded images if image dimensions exceed threshold (width above 1400 px or so). create impossible load big bitmap images (2000 x 2000 px) without quality going unusable. i tested by loading 1 big image , drawing on - got pixel garbage out. if draw grid lines using lineto() on have perfect quality, bad must in image pixel data slicing big image 100 x 100 slices , drawing them canvas - method found resulting no quality reduction. however, slicing cumbersome, adds step preprocess images , page loading times suffers i tested tring load image new image() object, tag , css background: suffers reduced quality, suspect probelm image loader itself i tried css image-rendering https://developer.mozilla.org/en/css/image-rendering - no luck viewport tag seems hav...

java - design a test program: increase/decrease cpu usage -

java - design a test program: increase/decrease cpu usage - i trying design , write java programme can increase/decrease cpu usage. here basic idea: write multi-thread program. , each thread float point calculation. increase/decrease cpu usage through adding/reducing threads. i not sure kinds of float point operations best in test case. especially, gonna test vmware virtual machine. you can sum reciprocals of natural numbers. since sum doesn't converge, compiler not dare optimize away. create sure result somehow used in end. 1/1 + 1/2 + 1/3 + 1/4 + 1/5 ... this of course of study occupy floating point unit, not central processing unit. if approach or not main question should pose. java design testing implementation

datagrid - WPF ItemSource returns null -

datagrid - WPF ItemSource returns null - i have named class public class testclass { public testclass(string showcode, string urn) { showcode = showcode; urn = urn; } public string showcode { get; set; } public string urn { get; set; } } i create arraylist, add together list , bind wpf datagrid arraylist l = new arraylist(); l.add(new testclass("ose11", "7016463")); this.grdtestdata.itemssource = l; this displays want in datagrid. now want datagrid's info , iterate throught it ienumerable<testclass> t = this.grdtestdata.itemssource ienumerable<testclass>; ..but 't' null! !! problem !! this datagrid definition: <datagrid autogeneratecolumns="false" horizontalalignment="left" margin="12,66,0,48" name="grdtestdata" width="200" canuseraddrows="true" > <datagrid.columns> <datagridtextcolumn...

What does the -batch flag do in Emacs (or unix in general)? -

What does the -batch flag do in Emacs (or unix in general)? - i want know meaning of "-batch" flag in emacs (or unix in general)? i utilize when do: emacs -batch -l dunnet and wondering heck lol. thanks (note: i'm not advanced programmer pls maintain answers/comments 'simple' me) from tfm: next options useful when running emacs batch editor: --batch edit in batch mode. editor send messages stderr. alternative must first in argument list. must utilize -l , -f options specify files execute , functions call. see emacs wiki info batch mode. (there no flags in "unix in general"). unix emacs

Getting an active connection on a Blackberry -

Getting an active connection on a Blackberry - i connection parameters http phone call using code follows below. it works on test phones , emulators. people (possibly 9700 users, can't guarantee it) causes "failed transmit" errors when have otherwise working 3g/wifi connection. what doing wrong? private string getconnectionparameters() { string strcp = null; int coveragestatus = coverageinfo.getcoveragestatus(); if((coveragestatus & coverageinfo.coverage_direct) == coverageinfo.coverage_direct) { // carrier coverage string carrieruid = getcarrierbibsuid(); if(carrieruid == null) { string wap2 = getwap2servicerecord(); if (wap2 != null) { // seek using wap2 strcp = ";deviceside=false;connectionuid="+wap2; } else { // has carrier coverage, not bibs or wap2. utilize carrier's tcp network strcp =...

caching - Clear ASP.NET Temporary Assemblies Without Restarting IIS -

caching - Clear ASP.NET Temporary Assemblies Without Restarting IIS - i moved code out of app_code folder , i'm getting classic conflict issue between code i'm compiling in project , existing temporary compiled assemblies in temporary cache. know can delete temporary assemblies, requires stopping iis. need in deployment strategy way our production environment , don't want restart iis. there way this? can try stop website (not iis) try deleting temporary files second alternative (risky) 1. kill asp.net worker process (this criminal locking out files in temp folder) 2. seek deleting temp files. its hard recognize process locking out files, if running in not isapi environment, i.e. wp exe file, can utilize file monitoring tools find out process id accessing/locking file, utilize task manager kill it. cheers. asp.net caching iis

datetime - How to calculate the difference between two dates using PHP? -

datetime - How to calculate the difference between two dates using PHP? - i have 2 dates of form: start date: 2007-03-24 end date: 2009-06-26 now need find difference between these 2 in next form: 2 years, 3 months , 2 days how can in php? for php < 5.3 otherwise see jurka's reply below you can utilize strtotime() convert 2 dates unix time , calculate number of seconds between them. it's rather easy calculate different time periods. $date1 = "2007-03-24"; $date2 = "2009-06-26"; $diff = abs(strtotime($date2) - strtotime($date1)); $years = floor($diff / (365*60*60*24)); $months = floor(($diff - $years * 365*60*60*24) / (30*60*60*24)); $days = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24)); printf("%d years, %d months, %d days\n", $years, $months, $days); edit: preferred way of doing described jurka below. code recommended if don't have php 5.3 or better. several people in c...

ruby - Use hash select for an array -

ruby - Use hash select for an array - i have hash h = {a=> 1, b=> 2, c=> 3} and array a = [a, b] is possible utilize h.select {|k,v| k == array_here?} to select elements array exists in hash? i found solution h.select {|k,v| a.include?(k) } you're going backwards. seek this: a.select {|e| h.has_key? e } ruby

How would you create a thumbnail of the first page of a pdf using php but not using ghostwrite and imagemagick -

How would you create a thumbnail of the first page of a pdf using php but not using ghostwrite and imagemagick - how create thumbnail of first page of pdf using php not using ghostwrite , imagemagick. have restrictions on clients server provider not allow installed. two options spring mind: post pdf script running on server have pdf reading library, processing there, , homecoming image in response. another thought upload statically-compiled re-create of ghostscript , upload webhost , phone call using system(). while host might not install , back upwards software you, statically compiled binary has worked me in these situations. php pdf imagemagick jpeg

iphone - Dismissing a UIAlertView -

iphone - Dismissing a UIAlertView - i set in app purchase app, , when user taps button, purchase started. basically, tap button, , depending on speed on net connection, waiting 10 seconds until new alert view comes asking if purchase product. user tap button multiple times since nil came up, , multiple purchase alert views come up. additionally, maybe seen user app bug. in end, problem. i want alert view come spinning wheel says "loading..." when users taps purchase button. problem is, how dismiss when new alert view comes asking user if want purchase product? if ([uialertview alloc] says: @"whatever apple's alert view says") { //dismiss "loading..." alert view here } i uncertainty work, input appreciated. thanks! you need have access alertview. can this. create alertview instance var in app delegate , when want show loading initialize instance var assign property , when want dismiss phone call [alertviewinstance d...

Creating a composite foreign key in SQL Server 2008 -

Creating a composite foreign key in SQL Server 2008 - i have 2 tables i'd create foreign key for. primary table pk - key1 - varchar(20) pk - key2 - date secondary table pk - autoid fk - key1 - varchar(20) fk - key2 - date when seek create relationship between primary , secondary table, maintain getting message the columns in primary table not match primary key or unique constraint. there can many records in secondary table same key1 , key2 made primary key auto created number. any thoughts on how can set foreign key relationship between these 2 tables? some of focused, of context others having sort of problem (like searches first?) the first thing check when have problem creating key create sure did not fubar info types in 2 tables. if have bigint in 1 , int in other, blow. true on keys, more crop if utilize multiple fields. simple math shows reason why chance increases. the next issue data. if cannot create key due data, have find ou...

.net - How to access Pseudo Elements (:before, :after, etc) or Pseudo Classes (:hover, :visited, etc) using MSHTML? -

.net - How to access Pseudo Elements (:before, :after, etc) or Pseudo Classes (:hover, :visited, etc) using MSHTML? - i'm parsing document mshtml , need determine pseudo elements in document. right have reference ihtmlelement in .net code , need determine if element has pseudo elements such "before" or "after" applied it. for example, in illustration document code below, have reference clearfloat div (as ihtmlelement, mshtml .net code) , need determine pseudo element's "after" style is. how can mshtml? <style type="text/css"> .clearfloat:after { display: block; visibility: hidden; clear: both; height: 0; content: "."; } </style> <div class="clearfloat"> text... </div> more mutual pseudo classes, such ":hover". cannot figure out how determine :hover style. need pseudo elements, i'm hoping if can figure out how access pseudo classes mi...

Fastest way to calculate the size of an file opened inside the code (PHP) -

Fastest way to calculate the size of an file opened inside the code (PHP) - i know there quite bit of in-built functions available in php size of file, of them are: filesize, stat, ftell, etc. my question lies around ftell quite interesting, returns integer value of file-pointer file. is possible size of file using ftell function? if yes, tell me how? scenario: system (code) opens existing file mode "a" append contents. file pointer points end of line. system updates content file. system uses ftell calculate size of file. fstat determines file size without acrobatics: $f = fopen('file', 'r+'); $stat = fstat($f); $size = $stat['size']; ftell can not used when file has been opened append( "a" ) flag. also, have seek end of file fseek($f, 0, seek_end) first. php file filesize

Android Animation Library? -

Android Animation Library? - are there free android animation libraries can utilize in our applications ? the android built-in animations basic. want more fancy. - thanks in advance. there 1 out there now. nineoldandroid android android-animation android-library

java - JGraph AWT EventQueue exception on paint (with multithreading) -

java - JGraph AWT EventQueue exception on paint (with multithreading) - situation i have visualisation using jgraph. graph updated different thread instantiates visualisation. expected behaviour the graph should updated various worker threads. function threads phone call update graph syncronized , worker threads not causes concurrency issues between themselves. actual behaviour there (ocassionally) exception thrown in awt-eventqueue thread when painting. it's null pointer, it's index out of bounds. here's stack trace: exception in thread "awt-eventqueue-0" java.lang.nullpointerexception @ com.mxgraph.shape.mxconnectorshape.translatepoint(unknown source) @ com.mxgraph.shape.mxconnectorshape.paintshape(unknown source) @ com.mxgraph.canvas.mxgraphics2dcanvas.drawcell(unknown source) @ com.mxgraph.view.mxgraph.drawstate(unknown source) @ com.mxgraph.swing.mxgraphcomponent$mxgraphcontrol.drawcell(unknown source) @ c...