Posts

Showing posts from August, 2011

numpy - 3D Extrapolation in python (basically, scipy.griddata extended to extrapolate) -

i using griddata function in scipy interpolate 3 , 4 dimensional data. works champ, except returns bunch of nans because of points need outside range of input data. given n-d data works "linear" mode interpolation anyway, should snap have griddata extrapolation instead of returning nan. has done or found workaround? clarify: have unstructured data, can't use of functions require regular grid. thanks! alex not quite sure work , not available yet, in development version of numpy there 'pad' array function... https://github.com/numpy/numpy/blob/master/numpy/lib/arraypad.py one of options 'linear_ramp' extrapolates (pads) outward starting @ edge value , linearly increase/decreases specified end value. it pure python function copy path , import (untested me though)

php - Google Identity Toolkit HTTPS issue -

home url http login url https i have found if change login url although says submit unsecure data functions work. when in https functions nothing , cannot debug see what's going on. window.google.identitytoolkit.notifyfederatedsuccess({ "email": "email@domain.com", "registered": true }); does nothing. page loads , user far site goes logged in modal window still open the site needs refreshed show user have logged in. all window google commands nothing. idea why? page code: <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/jquery-ui.min.js"></script> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/googleapis/0.0.4/googleapis.min.js"></script> <script ...

javascript - How to override ajax=false so it switches to loaded dom page if exists -

i have few item htmls, each of contains single jqm-page. have index page. multi-jqm-paged html, each jqm-page category listing items. index.html item1.html item2.html +------------------+ +--------+--------+ +-------- |+-------+ | +--|cat. | next|->|cat. ||.cont- | | | +--------+--------+ |-------- ||ent |+-------+|<----+ | | | |+-------+|#cat1 || | | | | | || |bla bla bla | |bla bla | |link1+---------->| | | | |link2 || | | | | +-------+| +-----------------+ +-------- |+-------++-------+| ||#cat2 ||#cat3 || || || || ||link4 ||link3 || || || || |+-------++-------+| +------------------+ currently can link index item, smooth ajax loading. realized if want link item index#cat1, need use data-ajax=...

windows phone 7 - Not able to insert data into remote mySQL Database using PHP (resolved) -

i trying insert data remote mysql database using wp7 app values not inserted, php file works perfect queries getting inserted db using java(android). new c# facing challenge. the code goes this:- public mainpage() { initializecomponent(); textbox1.text = "http://www.abc.com/xyz/user_master.php?email=abc@xyz.com&username=abc&password=xyzz&phone=98989"; client = new webclient(); client.downloadstringcompleted += new downloadstringcompletedeventhandler(client_downloadstringcompleted); } void client_downloadstringcompleted(object sender, downloadstringcompletedeventargs e) { if (e.error == null) { textblock2.text = e.result; } } private void button1_click(object sender, routedeventargs e) { client.downloadstringasync(new uri(textbox1.text)); } please correct me. the problem using "downloadstringasync" sends , post variable not fi...

sql server - How to use newid() to assign a value to a stored procedure variable? -

Image
i trying generate new guid , assign value newreportid . but, unsure if replace @newreportid everywhere in procedure newid() generate new guid each line. what have generate 1 guid , assign newreportid value of guid? i have tried in variable declaration: @newreportid varchar(50)=newid() gave me lots of errors. alter procedure [dbo].[amendinsertduplicatefields] (@reportid varchar(50), @newreportid varchar(50)) begin insert [mvcomar].[dbo].[pridemvccollisionbegin] ([reportid], [localincidentnum], [version], [mtoreferenceno], [submitted]) select @newreportid, [localincidentnum], [version], [mtoreferenceno], [submitted] [mvcomar].[dbo].[pridemvccollisionbegin] [reportid]=@reportid; insert [mvcomar].[dbo].[pridemvccollisiondetails] ([classification] , [reporttype] ,[collisiondate] ,[collisionday] , [collisiontime] ,[collisionloc] ,[impactloc] ,[thrulaneno] , [weather1] ,[weather2] ,[light] ,[tr...

convert tz - Looking for a way to Query data from MySQL database & write it to a output txt file -

looking way query data mysql database & write output txt file. trying query linux server db remote windows box. mysql query: mysql -u xxx -pxxx -h ttplxapp-esm01.abc.com -d telalert -e "select max(convert_tz(start_time,\"+00:00\",\"-04:00\")) time,group_concat(username separator \" \") contact, message message sends convert_tz(start_time,\"+00:00\",\"-4:00\") \"$query_date%\" group alert_id order time desc ;" a java script or script ideal. try select...from statement into outfile clause. select syntax .

animation - Android view flickering at the beginning TranslateAnimation -

i use translateanimation move buttons , works fine, before animation started strange flickering apear. short time animated view moves position higher is. after view normal position , animation started. i use relativelayout , move 7 buttons. public void moveview(final int rotationtype) { animationset animationlist[] = new animationset[buttonamount]; (int = 0; < buttonamount; i++) { animationset animationsset = new animationset(false); animationsset.setfillafter(true); boolean visible = true; boolean hide = false; boolean show = false; imagebutton button = buttons.get(i); int position = + movementcount; if (position < 0) { position = getlastbuttonid(); } else if (position > getlastbuttonid()) { position = position - buttonamount; } int cl = getdp(leftcoord.get(position)); int cb = getdp(bottomcoord.get(position)); // todo left right ...

android - At what point does my application code stop running when the device goes to sleep? -

specifically, if have method running in activity class, when phone goes sleep (cpu off), method run completion before onpause() called? class myactivity extends activity { ... public void dosomework() { ... ... // <-- device goes sleep @ point in time ... return; // here before onpause() called? } ... @override public void onpause() { ... } ... } in addition activities, running thread (perhaps launched activity class) interrupted at whatever line of code it's at when device goes sleep? see contradicting answers in post: does thread launched activity continue running once device goes sleep? going further, understand activity's onresume() invoked when device wakes up; if dosomework() above or aforementioned thread indeed interrupted midway when going sleep, remaining code resume? thanks in advance insight. it's considered android practice not run long tasks on main ui thread, ther...

c# - XAML Cannot set value of property of base class from a different assembly -

it can hard come succinct title! i have 2 wpf projects in single solution. first, wpfapplication defines class1. second, wpfcontrollibrary defines class2 inherits class1, class3 inherits class2, , usercontrol1. shown below: wpfapplication class1 namespace wpfapplication5 { public class class1 { public string property1 { get; set; } } } wpfcontrollibrary class2 , class3 namespace wpfcontrollibrary1 { public class class2 { public string property2 { get; set; } } public class class3 : class2 { public string property3 { get; set; } } } in summary, class 1 has property1, class2 has property1 (thru inheritance) , property2, , class3 has property1 , property2 (both thru inheritance) , property3. xaml user control is: <usercontrol x:class="wpfcontrollibrary1.usercontrol1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" ...

ruby on rails - Join two tables and select record(table2) to form(table1) with drop-down-select -

i join 2 tables have table 'persons' , table 'factories'. my question is, how can add person , choose (with dropdown) factory person belongs to? my persons model: class person < activerecord::base has_many :factories has_attached_file :cv attr_accessible :cv, :email, :function, :mobile, :telephone end my factories model: class factory < activerecord::base belongs_to :persons attr_accessible :last_name, :email, :telephone, :first_name, :website, :country end i want example: | add person | function: (input field) telephone: (input field) mobile: (input field) email: (input field) factory (drop-down) <= actual field have , not placed in persons table default. cv: (upload field) submit: (submit button) i hope understand have , hope help. **edit 1 changed plans. have chosen factory.id in column in persons table. i made column in person table name factory.id to store data other table in column. possible?** ...

matlab - How to make a fusion of three similar looking graphs into one graph -

Image
i have x-cordinate graphs plotted against time of particular data. more accuracy data taken 3 times n hence have set of 3 graphs. graphs obtained similar not accuracy of 90%..and there no method of each time taking data more accuracy. need set single standard graph incorporates features of 3 (sample graphs obtained) more accuracy. please suggest me method so. an example of using mean/median: %# data , noisy estimates t = 1:100; x = cumsum(rand(size(t))-0.5); x1 = x + randn(size(x))*0.7; x2 = x + randn(size(x))*0.9; x3 = x + randn(size(x))*1.2; %# plot estimates clf subplot(211) plot(t,x1, t,x2, t,x3) legend({'estimate 1','estimate 2','estimate 3'}) %# mean/median across estimates subplot(212) plot(t,mean([x1;x2;x3]), t,median([x1;x2;x3])) hold on, plot(t,x, 'm:', 'linewidth',2), hold off legend({'mean','median','actual'}) if concerned outliers, see this ideas.

virtualhost - NameVirtualHost bad behavior on 2 IPs and 3 DocumentRoot -

i have next apache virtualhosts , namevirtualhost settings: namevirtualhost 10.100.106.89 <virtualhost 10.100.106.89> documentroot /var/www/html/dev/novared_soporte/branches/v0.3/soporte servername 10.100.106.89 </virtualhost> <virtualhost 10.100.106.89> documentroot /var/www/html/phpmyadmin servername 10.100.106.89/phpmyadmin serveralias 10.100.106.89/pma </virtualhost> <virtualhost 10.100.106.90> servername 10.100.106.90 documentroot /var/www/html </virtualhost> when try reach: 10.100.106.89 can site need: /var/www/html/dev/novared_soporte/branches/v0.3/soporte but when try reach 10.100.106.89/phpmyadmin error on error_log.txt (httpd logs): [thu jun 28 12:12:59 2012] [error] [client 10.100.103.31] file not exist: /var/www/html/dev/novared_soporte/branches/v0.3/soporte/phpmyadmin i still cant mistake. way, 10.100.106.90 working properly, @ least documentroot /var/www/html ...

odbc - Connect to Foxpro with PHP using OLE DB driver -

i'm trying connect foxpro database using ole db driver i downloaded driver http://www.microsoft.com/en-us/download/details.aspx?id=14839 , installed create php script $conn = new com("adodb.connection") or die("cannot start ado"); $conn->open("provider=vfpoledb.1;data source=c:\opera3\comp_i.dbc;collating sequence=machine"); this gives me following error fatal error: uncaught exception 'com_exception' message '<b>source:</b> adodb.connection<br/><b>description:</b> provider cannot found. may not installed.' in c:\inetpub\wwwroot\test1.php:4 stack trace: #0 c:\inetpub\wwwroot\test1.php(4): com->open('provider=vfpole...') #1 {main} thrown in c:\inetpub\wwwroot\test1.php on line 4 any in getting working appreciated. as requested uninstalled , reinstalled command line administrator users , works –

html - Prevent browser anti-aliasing when upscaling? -

Image
with google's chart image api (which unfortunately deprecated april 2012), can generate qr codes. i'm sure can change size of resulting image using api, i'd rather use css , width , height properties make little bigger. in chrome @ least, results in nasty anti-aliasing (not preferable, since needs parsable machines). there way tell browsers not anti-alias upscaled images? this guy has solution: http://nullsleep.tumblr.com/post/16417178705/how-to-disable-image-smoothing-in-modern-web-browsers img { image-rendering: optimizespeed; /* fuck smoothing, give me speed */ image-rendering: -moz-crisp-edges; /* firefox */ image-rendering: -o-crisp-edges; /* opera */ image-rendering: -webkit-optimize-contrast; /* chrome (and safari) */ image-rendering: optimize-contrast; /* css3 proposed */ -ms-interpolation-mode: nearest-neighbor; /*...

c# - Prevent Web page from caching while access through mobile -

i want prevent asp.net page browser caching. apply tricks available on internet,so browser stop caching page , every time request server page. but problem when access site through mobile blackberry cache page , on button press page access cache without ping server. searched lot found nothing special. one solution found said mobile browser stop caching when https request made is true or not? please help. here suggested method works mobile , desktop browser: prevent browser caching of web pages in asp.net works in browsers (ie/firefox..)

internet explorer - javascript date object issue in Safari and IE -

i taking date json object in format of 2012-12-31 , trying convert friendly values , output it. var redeemabledate = item.deal.redeemabledate; //this coming in form of 2012-12-31 var redeemabledate = new date(redeemabledate); var rdday = weekday[redeemabledate.getday()]; //using array weekdays var rddate = redeemabledate.getdate(); var rdmonth = monthnames[redeemabledate.getmonth()]; //using array month names var rdyear = redeemabledate.getfullyear(); response.write('valid ' + rdday + ' ' + rddate + ' ' + rdmonth + ' ' + rdyear + ' only'); it works find , dandy in firefox , chrome, safari , ie (only tested on ie8 far) don't it. in ff , chrome expected: valid sunday 2 september 2012 only but in safari , ie, get: valid undefined nan undefined nan only when alert redeemabledate after have set date object, safari returns 'invalid date' , ie returns 'nan'. issue lies. there way...

c++ - Creating Include Folder and Lib folders in Visual Studio Projects -

it looks general approach when download lib internet, or install sdk, hold folder having include , lib / bin folder. over years created several visual studio projects, c# or vc++ , wonder how people release libs when doing them. found simple make libs come out in lib folder , exes out in bin folder. are there easy ways make visual studio know header files supposed in include folder , make create when building, or should manual maintain folder? you make own macros in visual studio after build. check post build event macros box in project setting. can use script language perl handle build , post build events. second method better gives more flexibility.

visual studio - NDIS and miniport driver -

i trying modify ethernet driver using wdk tools provided in visual studio 2012. the samples provided in wdk 'miniport adapter' , 'ndis light weight filter' among others. still @ beginning of driver writing , hence finding tough navigate through code. i able install miniport adapter after building in visual studio 2012 [shows 'microsoft virtual miniport adapter' in network adapters list.] able assign ip address , subnet mask also.[i found out not connect physical device on pc]. i setup 'debug view' software check driver messages adapter.[ used 'dbgprint' statements in code , built it.] but, debug messages printed repeatedly. 1- why messages printed again , again? messages 'datapath.c' file of program , function 'mpsendnetbufferlists'. ['net buffer' specifies data sent or received on network.] 2- setup wireshark capture data on adapter , shows there requests arp,http,ssdp,mdns etc coming out of it. not able und...

ios - tableView not found on object of type -

i have class named firstviewcontroller subclass of uiviewcontroller , have uitableview in class. need transition class new uiviewcontroller subclass (using segues) when row pressed. i have made firstviewcontroller uitableviewdelegate , uitableviewdatasource using code - @interface firstviewcontroller : uiviewcontroller <uitableviewdatasource, uitableviewdelegate> i getting error on line of code - nsindexpath *path = [self.tableview indexpathforselectedrow]; how fix problem since tableview found in uitableviewcontroller , not in uiviewcontroller class ? edit - here's code related table view - - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section{ return [sarray count]; } - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath{ static nsstring *cellid = @"cell"; uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellid]; if(cell =...

c# - Using Regex to determine if string contains a repeated sequence of a particular substring with comma separators and nothing else -

i want find if string contains repeated sequence of known substring (with comma separators) , nothing else , return true if case; otherwise false. example: substring "0,8" string a: "0,8,0,8,0,8,0,8" returns true string b: "0,8,0,8,1,0,8,0" returns false because of '1' i tried using c# string functions contains not suit requirements. totally new regular expression feel should powerful enough this. regex should use this? the pattern string containing nothing repeated number of given substring (possibly 0 of them, resulting in empty string) \a(?:substring goes here)*\z . \a matches beginning of string, \z end of string, , (?:...)* matches 0 or more copies of matching thing between colon , close parenthesis. but string doesn't match \a(?:0,8)*\z , because of commas; example match "0,80,80,80,8". need account commas explicitly \a0,8(?:,0,8)*\z . you can build such thing in c# thus: string oksubstring = "0,...

php - Redirect if a post is in draft status -

i have 2 custom post types called 'project' , 'project-won'. if user goes single 'project' in draft status, want them redirected corresponding 'project-won' post. each post replicated across both post types, if there 'project' had following url: mydomain.com/?project=test-project/ , ther 'project-won' url: mydomain.com/?project-won=test-project/. can put @ top of 'single-project.php' template page such as <?php if($post->post_status == "draft"){ //add redirect here i don't know best way be? first of define global variable $post. check if loop. global $post; if( $post->post_status == 'draft' ) { /* redirect code here */ } try code may problem solved defining global variable $post.

Getting ZipException when trying to open a jar file -

Image
i have jar file. want see contents of jar file, when try unzip file getting error java.util.zipexception: error opening zip file . used command *jar tvf jar_file_name * in command prompt. think file password protected or else. there way open file can see contents. thankyou. it sounds file broken - example, may have fetched ftp in text mode, instead of binary, or if downloaded programmatically may have bug in download code. as quick test, try renaming zip file , open winzip or whatever favourite zip file client is. confirm whether or not it's bust. i don't believe there's such thing password-protected jar file.

android - 3 different XML parse using single SAX parser handler -

how parse 3 different xml file.xml files follow <?xml version="1.0" encoding="utf-8"?> <login> <item> <user_id>id</user_id> <user_name>piron</user_name> <user_status>false</user_status> </item> </login> <?xml version="1.0" encoding="utf-8"?> <logout> <logout_item> <user_id>id</user_id> <user_name>kumar</user_name> <user_status>true</user_status> </logout_item> </logout> <?xml version="1.0" encoding="utf-8"?> <registration> <registration_item> <user_id>id</user_id> <user_name>name</user_name> <user_status>user exist</user_status> </registration_item> </registration> how parse them using single sax handler(starte...

php path issue, solution needed -

the following code works when place script in root if (file_exists("pics/2012/blackhall primary/" . $_files["file"]["name"])) { echo $_files["file"]["name"] . " exists. "; } but if move script folder /teacher/ no longer works. i thought make path ~/pics/2012/blackhall primary/ work does. any ideas? thanks use / @ beginning indicate root folder original php file located if (file_exists("/pics/2012/blackhall primary/" . $_files["file"]["name"])) { echo $_files["file"]["name"] . " exists. "; }

iphone - Dynamically size UISlider based on audio file -

a user selects single .mp3 mediapicker. want dynamically set width of uislider based on length of .mp3 (in seconds). uislider displayed in uiscrollview timer animates/scrolls uislider during music playback (similar how audio track appears in imovie). **my question: how can set width of uislider no matter width ( .mp3 length in seconds), thumb "scroll" @ same speed , not change dependent upon length of song. ie. short song , long song, thumb should scroll @ same speed because width of uislider has changed according music length. i have been @ 2 days. appreciated. create instance of avaudioplayer mp3 file. set slider maximum , minimum value according audio file played: firstly set minimum value of slider. yourslider.minimum = 0; now set maximum value in slider using avaudioplayer's duration property gives total duration of mp3 or audio file: yourslider.maximum = ceilf(float)avaudioplayer.duration);

c - Win32 API - Trying to readfile, it's getting truncated -- why? -

i trying read file , display file in ascii or hex hedit. running other computations on file info right want see all. currently code displays first bit - "mz" - thats it. somehow accidentally truncating pszfiletext variable, want able view entire executable in window. bool readinexefile(hwnd hedit, lpctstr pszfilename) { handle hfile; bool bsuccess = false; hfile = createfile(pszfilename, generic_read, file_share_read, null, open_existing, 0, null); if(hfile != invalid_handle_value) { dword dwfilesize; dwfilesize = getfilesize(hfile, null); if(dwfilesize != 0xffffffff) { lpstr pszfiletext; pszfiletext = globalalloc(gptr, dwfilesize + 1); if(pszfiletext != null) { dword dwread; if(readfile(hfile, pszfiletext, dwfilesize, &dwread, null)) { pszfiletext[dwfilesize] = 0; // add null terminator if(setwindowtext(hedit, pszfiletext)) { ...

How do I mutate the DOM of a displayed HTML page, via Java, over HTTP (from the server)? -

i reference dom of displayed webpage can add , remove elements. add , remove elements sending http requests from, say, servlet. further, able construct dom, node-by-node, in browser, via java, http messages coming said servlet. suppose requests url (say): http://helloworld.xhtml i render content sending http messages, which, node node, build displayed document. then, if need change in document, able remove html node-wise, or add html in same manner; make partial changes html document via http. does know of specific way(s) accomplish this? i don't want use javascript, unless means utility method accomplish communication mechanism only. don't want use client-side applet either, might way of getting around limitations of http (i.e., sending java object responses via jaxb). i don't want use javascript because want use html browser displayer of elements relay occurence of events server. then, want able add or remove elements without redrawing page. also, use xsl...

activerecord - Rails: database not being updated after save is called -

i trying create association between 2 objects , save changes database. have included in notice call on object, test if saves after passes true if stament. when check see if update has occurred in data base nothing has changed. requests_controller.rb class requestscontroller < applicationcontroller before_filter :load_requestable def accept @request = request.find(params[:id]) @request.profile.send("#{@belongs_to}=",@requestable) if @request.save redirect_to [@requestable, :requests], notice: "request accepted #{@request.profile.send("#{@belongs_to}").name}" else render :new end end private def load_requestable klass = [company, profile].detect { |c| params["#{c.name.underscore}_id"]} @requestable = klass.find(params["#{klass.name.underscore}_id"]) @belongs_to = klass.to_s.downcase end end try saving profile directly (since you're modifying it...

c++ - How to use IStringStream to read from a file? -

i need read in expression file using string stream , convert expression form. having trouble figuring out how read lines file using istringstream. can me #includes , syntax this? thanks #include <fstream> std::ifstream file("filename.txt"); stufftype stuff; while(file >> stuff) { // if here have read stuff. }

css float - css four-column left floated layout with equal left and right margins -

i have four-column, left-floated layout. want equal margins left , right margins. i've floated 4 columns left , assigned right margin of 20px on each float. full width column div looks correct, margins , columns not displaying correctly on columns different widths. i've gone on math several times , eyes burning trying figure out i'm doing wrong. any suggestions on best way or how this? create 20px width first column total of 5 columns, or use tables. looking more elegant way of doing this, maybe it's not possible. have support ie7. thanks. code here - 4 column margins not correct i guess problem css didn't take padding account. in order more elegant should centred blocks equals margins. i've inspected code , modified little :) http://jsfiddle.net/w3yrf/5/ anyway, recommend use grid system such grid960 (http://960.gs/) give great hand on way! cheers!

c# - Control from WPFToolkit doesn't exist in namespace -

i added references wpftoolkit.dll , added .xaml file following line: xmlns:toolkit="clr-namespace:microsoft.windows.controls;assembly=wpftoolkit" and before following line: xmlns:toolkit="http://schemas.microsoft.com/wpf/2008/toolkit" in both cases in line <toolkit:numericupdown value="10" increment="1" maximum="10" minimum="0" /> i have error: error 1 tag 'numericupdown' not exist in xml namespace 'http://schemas.microsoft.com/wpf/2008/toolkit'. line 20 position 18. c:\users\diament\documents\visual studio 2008\projects\mybasicflyffkeystroke\mybasicflyffkeystroke\window.xaml 20 18 mybasicflyffkeystroke where problem? :( i had exact same problem. if skipped unblock step , unzipped, xaml preview window not load , vs keep giving me 'integerupdown component not exist in namespace http://schemas.xceed.com/wpf/xaml/toolkit ' error, though auto-complete happily...

jquery - Rails 3: How to sum multiple collection selections? -

i have select box collection called "size", values of 10, 25, 50, etc. can add/remove field using jquery that, example, there 3 different size selections on page: 25, 50, , 10. if want sum these values on page, , total of 85, how can accomplish this? audience.rb size = ['5', '10', '25', '50', '75', '100'] form.html.erb <%= f.fields_for :audiences |audience_form| %> <div class="audiencefields"> <span class="audienceforminsert"></span> <div> <%= audience_form.label :number_of_people, "size" %><br /> <%= audience_form.collection_select :number_of_people, audience::size, :to_s, :to_s, :include_blank => true %> </div> </div> <%= audience_form.link_to_remove "remove audience", :id => "removelink" %> <% end %> <p><%= f.link_to_add "add audience", :aud...

In ASP.NET, trying to find the assigned visibility value of a control that may be inside an invisible container -

i trying find out whether particular control on asp.net page has had it's "visible" property assign true or false. problem visible property crawl list of parents , if of them show invisible, queried control show invisible. need know control has been set to. i did searching , found post how set/real value of visible property in asp.net offered following solution public static bool localvisible(this control control){ var flags = typeof (control) .getfield("flags", bindingflags.instance | bindingflags.nonpublic) .getvalue(control); return ! (bool) flags.gettype() .getproperty("item", bindingflags.instance | bindingflags.nonpublic) .getvalue(flags, new object[] {0x10}); } but when tried it, returned "ambiguous match found" error on getproperty. can point out i'm doing wrong, or show way of getting want? i had same problem (two years later). answer wrote in topic refer to: in cas...

python - Update display all at one time PyGame -

using pygame, flickering things. boxes, circles, text, flickers. can reduce increasing wait between loop, though maybe eliminate drawing screen @ once, instead of doing individually. here's simple example of happens me: import pygame, time pygame.init() screen = pygame.display.set_mode((400, 300)) loop = "yes" while loop=="yes": screen.fill((0, 0, 0), (0, 0, 400, 300)) font = pygame.font.sysfont("calibri",40) text = font.render("texta", true,(255,255,255)) screen.blit(text,(0,0)) pygame.display.update() font = pygame.font.sysfont("calibri",20) text = font.render("begin", true,(255,255,255)) screen.blit(text,(50,50)) pygame.display.update() time.sleep(0.1) the "begin" button flickers me. slower computer, there way reduce or eliminate flickers? in more complex things i'm working on, gets bad. thanks! ...

java - When should one create new Thread Groups -

i wondering, advantages of assigning threads thread group instead of containing them in 1 (the main) group? assuming there 10 or more active threads, , couple of threads been initiated every , again application requires, how 1 approach grouping these? thanks, adam. there no advantage @ all. threadgroups there backward compatibility, i've never seen them used. here's brian goetz (author of java concurrency in practice - bible) said them long time ago: the threadgroup class intended useful in structuring collectionsof threads groups. however, turns out threadgroup not useful. better off using equivalent methods in thread. threadgroup offer 1 useful feature not (yet) present in thread: uncaughtexception() method. when thread within thread group exits becauseit threw uncaught exception, threadgroup.uncaughtexception() method called. gives opportunity shut down system, write message log file, or restart failed service. threads have uncauh...

How can i find the path of my file in my Java project file? -

i put file inside java project file , want read how can find path name java. here put in c driver want find path writing name of file. there function it? fileinputstream fstream1 = new fileinputstream("c:/en-gb.dic"); if file inside jar file generated project (or in classpath used project, generally), under package com.foo.bar , can load using someclassofyourproject.class.getresourceasstream("/com/foo/bar/en-gb.dic"); if it's not in classpath, , launch application (using java.exe) directory c:\baz , , file under c:\baz\boom\ , can load using new fileinputstream("boom/en-gb.dic");

Jquery draggable error -

Image
i have forked example on jsfiddle has tabs on dialog box http://jsfiddle.net/didierg/dnyyq/ , made few changes.first,i added title bar, http://jsfiddle.net/wwdpd/1/ , set draggable true http://jsfiddle.net/wzf5y/2/ the final fiddle surprisingly works on jsfiddle http://jsfiddle.net/wzf5y/2/ when run example of browser ff 12.0,the dialog hidden above top div;that above open dialog button. what missing?. image: it seems dialog (as overlay) being constrained div id="force" . firefox tries keep dimensions of div small possible given size of child elements. thus, when try drag dialog, gets pushed inside force div , since div covers top of page. in other browsers, dimensions of force div maximized, can drag dialog anywhere on page. can same behavior other browsers adding following css: #force { height: 100%; width: 100%; }

android - How to generate database with table of variable number of columns? -

in android app, need temporarily store data in form of table such follows: id | column 1 | column 2 | ... | column n the data downloaded server whenever users press button. however, data table doesn't have fix number of column (as row) every time user downloads server. example, server may send data 3 columns first time. might send data 5 columns second time, etc... given scenario, think database right data structure use. plan create database, add , delete tables necessary. have been reading various tutorials on android database (one example 1 http://www.codeproject.com/articles/119293/using-sqlite-database-with-android# ). seems me cannot create new table variable number of columns using sqlite database. correct? in oncreate(sqlitedatabase db) method, "create table" command must specified known number of columns , data types. provide several "create table" commands, each different number of columns seems crude. there way create database tables variable...

sql server - Insert into based on a select query with joins issue -

based on other table called tablecodes have 3 records code 1508 1509 1510 and have result query temporal table.... capacitydate installercode workareadid foxtelcodeid value 2/8/12 baw 7 1508 3 3/8/12 baw 7 1508 1 4/8/12 baw 7 1509 1 i need insert in same table other records missing based on tablecodes value = 0 i want capacitydate installercode workareadid foxtelcodeid value 2/8/12 baw 7 1508 3 2/8/12 baw 7 1509 0 2/8/12 baw 7 1510 0 3/8/12 baw 7 1508 1 3/8/12 baw 7 1509 0 3/8/12 baw 7 1510 ...

domain driven design - Bounded Contexts and Aggregate Roots -

we trying model rbac-based user maintenance system using ddd principles. have identified following entities: authorization aggregate root following: user (an entity object) list<authority> (list of value objects) authority contains following value objects: authoritytype (base class of classes role , permission) effectivedate role contains list<permission> permission has code , description attributes in typical scenario, authorization aggregate root since in user maintenance revolves around (e.g. can grant user 1 or more authority-ies either role or permission) my question : role , permission? aggregate roots in own separate contexts? (i.e. have 3 contexts, authorization, role, permission). while can combine in 1 context, wouldn't role heavy enough since loaded part of authorization "object graph"? firstly can't feel you've misunderstood concept of bounded context. you've described bc's describe entities...

database design - Storing an array of searchable values in MongoDB -

i need store role id , role name in each document in users collection. need able "get users have xyz role" or "get users have role who's name contains 'xyz'", stuff that. is possible in mongo? right now, i'm storing data this: { "_id": { "$id": "4fe30e3db92f5d2a5c000000" }, "alias": "rogue_coder", "display_name": "rogue coder", "email": "rogue@example.com", "roles": { "4fe30e5fb92f5d6f53000000": "super administrator" } } with that, can see if user has given role, can't users have role contains word "super" example. ideas on how this? based on attempting do, may have store role_id & role_name in separate arrays, such: { "_id": { "$id": "4fe30e3db92f5d2a5c000000" }, "alias": "rogue_code...

java - how to render Map<String, String> to template and use there -

i trying render key,value map template , show there in way: @(twittsifollow: map[string, string]) ..... @if(twittsifollow != null) { @for((key, value) <- twittsifollow) { @key @value } } it says, wrong. there scala tag map keys values? here method: public static map<string, string> alltwitts(list<long> otherids) { map<string, string> results=new hashmap<string, string>(); (long id: otherids) { query selected_twitt = jpa.em().createquery("select u.twitt twitt u " + " u.whose = ?").setparameter(1, id); string twowner = user.getoneuser(id); string twitt = (string) selected_twitt.getsingleresult(); results.put(twowner, twitt); } return results; } then render template in place: map<string, string> twittsifollow = twitt.alltwitts(idusersiamfollowing); return ok(microblog.render(twittsifollow)); now saying: [nonuniqueresultexception: result returns more 1 e...

templates - In C++, how can I get an arbitrary function's type from its declaration? -

possible duplicate: extract return type of function without calling (using templates?) starting (provided else): int my_function(int, int *, double); i want this: typedef boost::function_types::result_type< my_function_type >::type my_result; typedef boost::function_types::parameter_types< my_function_type >::type my_parameters; how my_function_type ? note: know boost_typeof() , seems bit scary, in "perhaps not totally portable"? decltype . examples: char foo(int) {} decltype (foo(3)) const *frob = "hello foo"; typedef decltype (foo(3)) typeof_foo; using typeof_foo = decltype(foo(3)); the expression decltype evaluated @ compile time , must resolvable. pass constexpr integer it.

linux - Create multiple Debian packages for data files from one source -

i have bunch of dictionary files dictd dictionary program. there 2 files each dictionary (a dict.dz , .index file) , there 8 dictionaries in total. the installation of dictionaries simple, have in script: install -o root -g root -m 644 /path/to/dictd_dictionaries/* /usr/share/dictd /usr/sbin/dictdconfig --write service dictd restart now want package lot of files .deb packages, 1 .deb package per dictionary. i'd have 1 source .deb package creates separate packages, rather having create , maintain 8 individual packages (a number might grow on time). however don't understand how debian/packagename.dirs files relate goes in debian/rules file. tried downloading , looking @ source package freedict, similar want do, rules file complex. you use dh-make package , specifiy "multiple binary". it's bit wizard creating skeleton debian/ directory. e.g. # dh_make --packagename=skeleton_1.0 perl: warning: setting locale failed. perl: warning: please ch...

mysql - mysqli DB connect scope? -

i'm trying use prepared statements insert data database, within function. the following works great when called outside file: function insert($value1, $value2) { $mysqli = new mysqli("localhost", "***", "***", "***"); if (mysqli_connect_errno()) { printf("connect failed: %s\n", mysqli_connect_error()); exit(); } if ($stmt = $mysqli->prepare("insert table (col1, col2) values (?, ?)")) { $stmt->bind_param('ss', $value1, $value2); $stmt->execute(); } } however want move connect string outside of function, results in scope issues. i've read need class this, can explain example please? thanks the easiest thing move connect line outside function (into global scope) , put following inside function @ start: global $mysqli; see: http://php.net/global you can use class if , have class variable store connection more involved. again, explained in php documentation...

debian - Will it be practical to implement deb preinst, postint, etc. scripts in Python, not in sh -

i'm interested in pitfalls can (except python not installed in target system) when using python deb package flow control scripts (preinst, postinst, etc.). practical implement scripts in python, not in sh? as understand it's @ least possible. the reason isn't commonly done, afaik, it's not convention, , python isn't more useful or straightforward plain shell script sorts of things maintainer scripts do. when more useful, can break out python-needing functionality separate python script called maintainer scripts. it can follow convention in sort of situation, since there lot of helpful tools , scripts (e.g., lintian, debhelper) assume maintainer scripts use bash. if don't, it's ok, tools may not useful otherwise. other issue think need aware of if preinst or postrm scripts need python, python needs pre-dependency ( pre-depends ) of package instead of depends . that said, i've found useful use python in maintainer script before.

adminhtml - Get id of deleted category [Magento] -

how id of deleted category observer? config.xml markup <adminhtml> <events> <catalog_category_delete_after> <observers> <my_module> <type>singleton</type> <class>my_module/observer</class> <method>oncategorydeleteafter</method> </my_module> </observers> </catalog_category_delete_after> </events> </adminhtml> observer code like: class my_module_model_observer { public function oncategorydeleteafter() { #do deleted category id } } use passed $observer variable. class my_module_model_observer { public function oncategorydeleteafter($observer) { $observer->getevent()->getcategory(); } }

javascript - why browser trigger a click event instead of a submit in a form? -

i have code http://jsfiddle.net/2gay9/3/ html <form action="/" method="get" onsubmit="return false";> test: <input type="text" value=""> <input type="submit" value="submit"> </form> js jquery('input').bind("keydown click", function(event){ console.log(event.type); console.log(jquery(this)); }); try hit return in input text , console: keydown jquery(input) click jquery(input submit) question: why browser triggering 'click' event on submit button, instead of trigger 'submit' event in form? project flaw or specification? how can cancel second event without cancel form submission? tks update in other words, need diferenciate event browser event. use: jquery('input').bind("keydown click", function(event){ event.preventdefault(); console.log(event.type); console.log(jquery(this)); }); ...

php - Inserting Integer value into mysql int using INSERT -

i'm trying insert new record in mysql database php, i've done million times before, reason, can't work time, , bugs me. inserting strings varchar collumns going great, when inserting value int column, error telling me have syntax error. basically, first query works fine, second 1 returns error, , can see, i've made damn sure integer i'm trying insert. i hope can help. i'm starting develop headache on :/ $groupid2 = 5; $groupid = (int)$groupid2; if(!mysqli_query($link, "insert contestants (firstname, lastname, email) values ('$firstname', '$lastname', '$email')")) echo "first: " . mysqli_error($link); if(!mysqli_query($link, "insert contestants (firstname, lastname, email, group) values ('$firstname', '$lastname', '$email', '$groupid')")) echo "second: " . mysqli_error($link); group mysql keyword use quotes around it "insert contestants...

http - How to redirect user's browser URL to a different page in Nodejs? -

in application i'm trying write, main page ( http://localhost:8675 ) has following form: <form action='/?joinnew' method='post'> <button>start</button> </form> here code in server.js: http.createserver(function(request, response) { var root = url.parse(request.url).pathname.split('/')[1]; if (root == '') { var query = url.parse(request.url).search: if (query == '?joinnew') { var newroom = getavaliableroomid(); // '8dn1u', 'idjh1', '8jm84', etc. // redirect user's web browser new url // ??? how do. need redirect 'http://whateverhostthiswillbe:8675/'+newroom ... }}} i love if there way didn't have know host address, since changing. the 'http' object regular require('http'), not require('express'). response.writehead(301, {location: 'http://whateverhostthiswillbe:8675/'+newroom} ); response.end...

fonts - How to type android robot logo -

all, i wanted know how can type android logo , display it. went through link http://osxdaily.com/2009/11/06/how-to-type-the-apple-logo/ goes apple 1 , on mac os. option + shift + k. downloaded droid-font , tried copy-pasting it. doesn work. how can , display droid logo icon same way. help needed. no, that's possible. apple logo isn't possible in cross-platform way, noted. you might want read: wikipedia's article on unicode private use the apple logo in unicode

c++ - Why won't this code compile? -

with const , indicated comment, msvc 11 , g++ 4.7.0 refuse compile this: #include <memory> // std::unique_ptr #include <utility> // std::move using namespace std; struct commandlineargs { typedef unique_ptr< wchar_t const* const [], void(*)( wchar_t const* const* ) > pointerarray; //pointerarray const args; // oops pointerarray args; int const count; static wchar_t const* const* parsed( wchar_t const commandline[], int& count ) { return 0; } static void deallocate( wchar_t const* const* const p ) { } commandlineargs( wchar_t const commandline[] = l"", int _ = 0 ) : args( parsed( commandline, _ ), &deallocate ) , count( _ ) {} commandlineargs( commandlineargs&& other ) : args( move( other.arg...

Cakephp using the returned array values -

i guess should smple, have been stuck @ while need help. have cakephp application , getting following array: chratsortedmean= array( 'totalaucfourhour' => array( 'screening visit-1 (scr)' => array( 'mmttfourthhour' => array( 'totalaucs' => array( (int) 0 => (float) 0, (int) 1 => (float) 220 ) ) ), 'month12' => array( 'mmttfourthhour' => array( 'totalaucs' => array( (int) 0 => (float) 263.25, (int) 1 => (float) 16.25 ) ) ) ), 'totalauctwohour' => array( 'day0' => array( 'mmttsecondhour' => array( 'totalaucs' => array( (int) 0 => (float) 0, (...

Converting Html utf-8 charset to ISO-8859-1 via C# -

i've been struggling convert html value of attribute, without success. here the html trying convert (sure charset not shown here, but, see see it). <a href="https://sistemas.usp.br/jupiterweb/listargradecurricular?codcg=12&amp;codcur=12012&amp;codhab=1&amp;tipo=n" target="_blank">administração – são paulo – diurno</a> all right, value of htmlnode "administração - são paulo - diurno". i using htmlagilitypack parse htmlpage this, , once reach node, innertext value : administração â são paulo â diurno i assuming original charset of page utf-8 because thats encoding tag on html says me. how can convert weird string : administração - são paulo - diurno ? i've tried these threads : thread one , thread two , nothing solved issue edit: getting page via c# webrequest get. edit2 : added htmlagilitypack tag the problem isolated : webrequest messing html sometimes. is there other way set encoding ? tryin...

javascript - CSS3 Smooth transition when dynamically changing animations -

i have 2 keyframe animations "bounce-in" , "bounce-out" bounce-in animation takes 1.2 seconds complete, if user triggers bounce-out function before it's finished jump 100% scale , doesn't gracefully scale out it's current animation position. is possible keyframe animations? i've seen done transition property not using scale(). @-webkit-keyframes bounce-in { 0% { -webkit-transform: scale(0) } 40% { -webkit-transform: scale(1.0) } 60% { -webkit-transform: scale(0.7) } 80% { -webkit-transform: scale(1.0) } 90% { -webkit-transform: scale(0.9) } 100% { -webkit-transform: scale(1.0) } } @-webkit-keyframes bounce-out { 0% { -webkit-transform: scale(1.0) } 40% { -webkit-transform: scale(0.1) } 60% { -webkit-transform: scale(0.4) } 80% { -webkit-transform: scale(0.1) } 90% { -webkit-transform: scale(0.2) } 100% { -webkit-transform: scale(0) } } i have demo on jsfiddle: http://jsfiddle.net/vn3bm/98/ *if click "games" circle before anima...