Posts

Showing posts from June, 2015

java - Change Eclipse's project location in file-system -

i have project of eclipse located in folder on my local-disk. let's say: c:\proj1.0 , after while need change folder name proj2.0 (why? because started working on next version of application , want save time of creating new project in eclipse. older version stored in source control anyway) how can it? if try change project cannot found eclipse. didn't find eclipse configuration file absolute location of project defined. you have change project's name eclipse. in package explorer right-click project -> refactor -> rename . or click on project , press alt + shift + r . way no configuration lost. another way move project's folder right-clicking on project > refactor > move . alternatively, if renamed folder's name , cannot see project in eclipse anymore, can select file menu -> import -> existing projects workspace , navigate parent folder of project's folder, select projects want import , press finish.

java - JLabel - how to hide a text? -

i have jlabel icon , text. there possibility hide jlabel's text ? don't want hide whole component (setvisible(false)), text, icon remains visible. i'd still use gettext , settext methods. thanks help! as far i'm concerned, there's no direct way this. try of following: extend jlabel , override settext() , gettext() methods. these should store text give in new string field. every time call settext should delegate super.settext() label-text not invisible. add method switches visibility. if call settextvisibility() true, class should call super.settext() string of spaces. here's example of mean: public class mylabel extends jlabel { private string labeltext; private boolean labeltextvisible = true; private mylabel( string text, icon icon, int horizontalalignment ) { super( text, icon, horizontalalignment ); labeltext = text; } private mylabel( string text, int horizontalalignment ) { super( text, hori...

android - I changed package name, changed the app_name but installer still overwrites previous version -

for diagnostic purposes, trying install android device 2 different versions of same app. in order accomplish that, duplicated project , changed the: project name package name app name (as appears in application's "android:label" in androidmanifest.xml) however, when install modified app, overwrites older app (with different project name, package name , app name). apparently, missing else needs changed, in order let both projects exist on android phone side-by-side. what "something else"? i think need change package name text in android manifest. if change package in eclipse properties menu project, doesn't change actual androidmanifest.xml. edit: package name identified in androidmanifest.xml unique indetifier application, think, perhaps, not referencing root package of android project's source code. think it's best practice them 1 in same, see release alternate version of app (i.e. paid vs free) changing manifest appli...

python - Question Regarding API Design -

i in process of researching best "design-pattern" web api. using django web framework. created non-ajax interface causes entire page reload @ each request. now, starting incorporate ajax interface. sake of discussion, 2 example pieces of functionality need add api following 1) beta page: user supplies email address. want make ajax call serverside see if exists in db. initial design call view function similar to def check_email(request): if request.method == "post": # check db # return json true/false 2) profile picture uploads, new profile picture added page without full page reload as far can tell, best way via post call view function. then, response return json, can inject dom accordingly. can please let me know if on right track designing api? note: have checked out django-piston, , seems pretty useful also. thanks you're right on track, use request.is_ajax() check if it's ajax request return respon...

c# - Exiting a thread that does not have a loop -

i need way stop worker thread not contain loop. application starts thread, thread creates filesystemwatcher object , timer object. each of these has callback functions. have done far add volatile bool member thread class, , use timer check value. i'm hung on how exit thread once value set. protected override void onstart(string[] args) { try { watcher newwatcher = new watcher(...); thread watcherthread = new thread(newwatcher.watcher.start); watcherthread.start(); } catch (exception ex) { ... } } public class watcher { private volatile bool _stopthread; public watcher(string filepath) { this._filepath = filepath; this._lastexception = null; _stopthread = false; timercallback timerfunc = new timercallback(onthreadtimer); _threadtimer = new timer(timerfunc, null, 5000, 1000); } public void start() { this.createfilewa...

Get Youtube address in PHP -

i have got forum written in php. i need detect when posts youtube url , grab whole url/string. any ideas ? preg_match_all('/(http:\/\/www\.youtube\.com\/watch\?v=[^\s]*)/si', $str, $match_urls); this matches youtube video links.

javascript - Raphael js, animate along path problem -

i have defined 2 circles , 1 path, path connect center points of 2 circles: c1=r.circle(40, 40, 20).attr(dashed); c2=r.circle(140, 40, 20).attr(dashed); path = r.path("m 40 40 l 100 0"); i have feature when mouse click on path line, left circle c1 collapse right circle c2 (that's left circle c1 move , join right circle c2 ), , during process, path connect center points of 2 circles , that's path shorter , shorter 2 circles closer. i not sure how implement feature, tried thing like path.onclicke(){ c1.animatealong(path, 1000, true, function (){ c1.attr({cx: 140, cy: 40}); }); } but don't know how handle path, path getting shorter c1 closer c2. can help? i've done share of wrestling paths in last 2 weeks, assure you. happened notice .attr() , .animate() path objects can given entirely new path string (see documentation @ http://raphaeljs.com/reference.html#element.attr ). so, mocked example in horrible day-glo colors , got result...

sql server - SQL Framing Query Problem -

Image
i running sql query returns portion of entire data. in other words, data 'framed.' have 'order(order by' part , whatever reason, part isn't working of time. expect, , other times don't. the query: select * ( select row_number() over(order [datetime] desc, timemicrosec desc) rownum, ... ... ... ) temptbl rownum between @startrow , @endrow; the whole data query works when not framed , use 'order by' clause @ end. in image below, [datetime] column , [timemicrosec] column joined string concatenation. as can see, ordering messed up. appreciated. when cast datetime varchar, changes way sql server order column. no longer order chronologically, instead plain old string. if data type datetime, following descending sort order: 01/11/2011 02/22/2010 the first date later chronologically... if data type varchar... sorted as: 02/22/2010 01/11/2011 because string "02" comes a...

jquery - hover / setInterval : undefined time lapse -

try use 'hover' function , setinterval same div : if hover div, setinterval starts. have problem : seems 2 different divs, when hover second div, first 'waits' 1000 ms before starting 'setinterval' of second div. when hover second div, both of them stay current image, , after moment setinterval of second div starts. (i quick, not wait ms). do know how that? here's code : var intval; img.bind('mouseenter', function(){ var = $(this); intval = setinterval(function(){ next(that); },1000); }).bind('mouseleave', function(){ var = $(this); clearinterval(intval); }); thanks lot. by calling next() in mouseenter event should work. var intval;     img.bind('mouseenter', function(){   var = $(this);   next(that); intval = setinterval(function(){   next(that);   }, 1000);   }).bind('mouseleave', function(){   var = $(this);   ...

sql server - The COMMIT TRANSACTION request has no corresponding BEGIN TRANSACTION -

here's strange problem i'm running on production server. has happened twice in last 2 weeks, , server gets lot of traffic. we have code in web service executes begin tran, runs few sql queries (two inserts followed update). @ end executes commit. twice have gotten message in logs: the commit transaction request has no corresponding begin transaction. between first 2 inserts , update, call web service, there slight delay between first 2 inserts , last update before commit called. causing our problem? we're running on iis 7 , server 2008 r2 (all updated applied). originally though the app pools getting recycled, changed recycle in middle of night. i'm not sure causing sql server forget call begin tran. this web service called quite bit. has seen before? i'm @ total loss @ moment... any or suggestion appreciated greatly! it looks transaction failed, got rolled , there nothing commit example of such thing create table blatest(id int prim...

wpf - A generic Boolean Convertor -

i have following converter [valueconversion(typeof(bool), typeof(visibility))] public sealed class booltovisibilityconverter : ivalueconverter { public visibility truevalue { get; set; } public visibility falsevalue { get; set; } public booltovisibilityconverter() { // set defaults truevalue = visibility.visible; falsevalue = visibility.collapsed; } public object convert(object value, type targettype, object parameter, cultureinfo culture) { if (!(value bool)) return null; return (bool)value ? truevalue : falsevalue; } public object convertback(object value, type targettype, object parameter, cultureinfo culture) { if (equals(value, truevalue)) return true; if (equals(value, falsevalue)) return false; return null; } } <conv:boolconverter x:key="enablestyleconvertor" truevalue="visible" false...

Android - Preventing Application data or files being deleted thru "Clear Data" settings option -

i have android application stores 25-40k of private app data in few files. default sytem stores these files in directory /data/data/'my app package'/files. when user goes "setting->applications->manage applications->'my app package'" , chooses "clear data" option, files, databases folders app being deleted. need keep data on device until app "uninstalled". is there way keep application data "on device" somewhere without being deleted? device not rooted. app not meant on rooted devices. note: saw /data/data/'my app package'/lib directory not being deleted using "clear data" option. couldn't programatically write direcroty. permission denied. there way use directory store data? there way use ndk (not worked on yet) keep data safe? there way keep data in application reosurce or dll resource in windows programing. any please me out of jam? appreciate it. thank you; have day. jacob th...

How to assign "Null" as a value to a string variable in Java -

i trying import users active directory , in 1 of cases, user has last name null. can have pointers how should take 1 down? that should no problem, since read string value "null" not null .

css - CSS3, WebKit Transition Order? How to queue to the transitions? -

i have following: -webkit-transition-property: top, bottom, z-index; -webkit-transition-duration: 0.5s; problem don't want z-index transition until after top & bottom done. is there way tell webkit transition transition top/bottom , when done, z-index instantly or duration, either way? thanks you have specify delay on z-index transition: -webkit-transition-property: top, bottom, z-index; -webkit-transition-duration: 0.5s; -webkit-transition-delay: 0s, 0s, .5s;

objective c - Does core data do its own type casting in the background? -

i working on simple comparison of 2 lists see items in "evaluation" list contained in larger "target" list. getting data on-the-fly- parsing 2 csv files , storing strings. import data data store , can list of entities no problem the problem comes when search. essentially, looking short isbns in form of 1234 evaluation list in target list, in form of 1234-5 . predicate using using contains comparison in form of [nsstring stringwithformat:@"%@ contains %@", koc_target_printbookcode, evalisbn] the error following (grabbed nslog ) nsinvalidargumentexception: can't value (1494) in string (49885); value not string i impression though isbn being read nsstring , core data store has data point spec'd string, core data still doing in background value whatever reason sees fit. ideas? here relevant process logic (though use term dubiously) code. unless otherwise noted in code, values being manipulated and/or stored nsstring : nsarray *evalb...

flash - Are actionscript bitmaps faster than vectors? -

i'm working on project draws circles continuously @ framerate , animates them around stage , i'm running performance issues. i'm converting objects bitmapdata become static. question is, converting circles bitmapdata drawn increase performance? in other words, animating say, 200 bitmaps (with transparency) faster 200 vector circles? are there drawbacks technique? (i'm thinking opacity problems maybe?) if more complex shapes circles answer different? any other tips on improving performance? thanks lot! there several approaches might consider here: bet on vector renderer drawing lines , circles each frame. they'll re-rendered every time, that's flash heavily optimized for, it's not impossible faster alternatives. (note drawing objects @ different sizes each frame might faster drawing them each sprite , changing size.) bet against vector renderer moving bitmaps around. simple way (assuming you're drawing shapes as3) draw shapes...

Passing special chars from java to jsp in XML format -

i fetching data db contains "&". writing stringbuffer , passing in xml format jsp. in jsp when doc.getelementbytagname("tagname") , fetchin childnode length getting null. xml data contains "&". data fetching huge. effective way replace "&" & in java <parentnode> <childnode> <data1>a & b</data1>c & d<data2></data2> <data1>e & f</data1><data2></data2> <data1></data1><data2></data2> .. .. </childnode> </parentnode> you need escape it. since seem print xml plain in jsp (which poor approach, aside), can use jstl <c:out> this. <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> ... <c:out value="${bean.somexmlstring}" /> alternatively, can escape in java side using apache commons lang stringescapeutils#escapexml() . stringbuilder.append(stringesca...

java - Javac erroring out when compiling Servlet libraries -

i using ubuntu , have set paths following: java_home=/usr/local/jdk1.6.0_24 export classpath=/usr/local/tomcat/lib export java_home i thought put servlet libraries in compile path, still getting compile errors this: package javax.servlet not exist [javac] import javax.servlet.servletexception; any ideas how fix or doing wrong? general java libraries seem working fine. with jar files, specifying directory containing jar files not work. have 2 options: specify each jar file individually on classpath: export classpath=/usr/local/tomcat/lib/servlet-impl.jar:/path/to/another.jar since you're using java 6, should able use wildcards (to include jars in directory): export classpath=/usr/local/tomcat/lib/*

Java - Rich logging in web services -

i have simple web service this: @webservice public class mywebservice { @webmethod public string processquery(@webparam(name="query") string q) { // logging here: user ip, etc. } public static void main(string[] args) throws exception { string address = "http://127.0.0.1:8023/_webservicedemo"; endpoint.publish(address, new mywebservice()); new documentserver(); system.out.println("listening: " + address); } } i want add logging method service extract information. i've heard ncsa format , log4j don't know how use them in service. want log user's ip , other info. how can it? thanks. edit: should note main part of question how can retrieve data such user's ip, client, etc. in web method. add webservicecontext class, can httpservletrequest : @webservice public class mywebservice { @resource webservicecontext wscontext; @webmethod public string processqu...

How do I start a background process in Ruby? -

i'm having difficulties starting background process in ruby. i've code right now. #!/usr/bin/env ruby -w require "daemons" require 'rubygems' path = "#{file.expand_path(file.dirname(__file__))}/.." daemons.run_proc('stalker',{ :dir_mode => :normal, :dir => "#{path}/tmp/pids", :backtrace => true, :monitor => false, :log_output => true }) system "stalk #{path}/config/jobs.rb" end i start script using script/stalker start . the problem can't stop it. saves wrong pid pid file. like this: script/stalker start => stalker: process pid **39756** started. ps aux | grep ruby => linus **39781** 0,3 1,9 2522752 78864 ?? s 8:39pm 0:10.11 ruby stalk script/../config/jobs.rb why doesn't first pid match 1 printed using ps aux | grep ruby ? i've tried using exec , %x{} , 1 system run script. if use run_proc , code want daemonized should go in b...

css - Minimize HTML page load time if it contains image icons -

i want html page loads faster can. i'm trying put css styles same .css file , javascript code 1 .js file. how colleagues told me makes web page load faster. want ask questions it. just sure: colleagues right? on situations it's better break css or js code separate files? question is: if have lot of small icons on page, "delete, edit, add", should load image icons @ once or each icon separately? if i'll load icons @ once, how select desired one, if icon's size 40x40px? thank you! are colleagues right? single files can downloaded single http requests (with single sets of http headers, etc, etc) , can compressed more efficiently multiple files. performance perspective, if need content, better place them in single file. on situations it's better break css or js code separate files? when need specific page load (e.g. homepage) or when there sections of site use large chunk of script isn't used elsewhere can beneficial break...

Python port listner application / tool -

hi keep python application in port listener. structure : when ever data comes port has analyse , return data + associated value determined program. there tools / modules available take @ twisted : twisted event-driven networking engine written in python , licensed under mit license.

mysql - How can I speed up my query? -

how can speed query? use mysql 5.1, table 'schedule' has ~ 900 k rows, , query takes more minute run: select doc_code, `date`, time2, pat_code, status, copiedto1, copiedto2, copiedto3, copiedto4, copiedto5 schedule 1=1 , status in (5,6,30) , (doc_code="k9" or copiedto1="k9" or copiedto2="k9" or copiedto3="k9" or copiedto4="k9" or copiedto5="k9") , `date` between "2010/04/11" , "2011/04/11" , pat_code > 0 order `date`, doc_code, time2 i experimented add different indexes, query doesn't want use of them. appreciated. i change into select s.* ( select doc_code, `date`, time2, pat_code, status, copiedto1, copiedto2, copiedto3, copiedto4, copiedto5 schedule status in (5,6,30) , `date` between "2010/04/11" , "2011/04/11" , pat_code > 0 order `date`, doc_code, time2 ) s (s.doc_code="k9" or s.copiedto1="k9"...

c - What is the best way to avoid overloading a parallel file-system when running embarrassingly parallel jobs? -

we have problem embarrassingly parallel - run large number of instances of single program different data set each; submitting application many times batch queue different parameters each time. however large number of jobs, not of them complete. not appear problem in queue - of jobs started. the issue appears large number of instances of application running, lots of jobs finish @ same time , try write out data parallel file-system @ pretty same time. the issue seems either program unable write file-system , crashes in manner, or sits there waiting write , batch queue system kills job after it's been sat waiting long. (from have gathered on problem, of jobs fail complete, if not all, not leave core files) what best way schedule disk-writes avoid problem? mention our program embarrassingly parallel highlight fact each process not aware of others - cannot talk each other schedule writes in manner. although have source-code program, we'd solve problem without having mo...

How do I left join onto a mysql range case group by query? -

how left join average onto query? select t.range, count(*) num (select case when price < 50000 '0 - 49k' when price >= 50000 , price < 100000 '50 - 99k' when price >= 100000 , price < 200000 '100 - 199k' ... range, price table) t group range i've tried select t.range, count(*) num, avg(b.val) (select case when price < 50000 '0 - 49k' when price >= 50000 , price < 100000 '50 - 99k' when price >= 100000 , price < 200000 '100 - 199k' ... range, price table) t left join table2 b on b.id = t.id group range and various other feeble attempts no avail. hard without knowing more "table2" , how relates "table", first thought join inside subquery instead of outside of it: select t.range, count(*) num, avg(t.val) (select case when price < 50000 '0 - 49...

c++ - Qt: How to repeat sound x times with QtSound -

i'm not sure understand correctly how qsound.setloop function should work. i want play wave file 3 times. tried following code plays once. qsound soundobj(filepath); soundobj.setloops(3); soundobj.play(); help :-) edit: full version of code looks this void alarms::playsound(qstring filepath) { qsound soundobj(filepath); soundobj.setloops(3); soundobj.play(); } soundobj object destroyed quickly. has allocated dynamically.

java - Does attaching a profiler cause some things to run slower then others? -

is possible attaching profiler jvm (let's visualvm) make methods run slower, while not effecting others , causing skew in results makes piece of code hotspot when in fact it's not. ask reflection calls example. i'm running code shows lot of time spent in spring aop calls (specifically invokejoinpointusingreflection) - author says runs fine in testing (using in code microbenchmark) when profiled showed method take longer other non-reflection methods. (sorry if that' little unclear) got wondering if profiler have effect , lead developer down false trail. feel free answer examples, reflection part example. profilers regularly give mis-leading information, in right. tend skew result in simple methods might further optimised if profiling wasn't enabled. if in doubt suggest use profiler, such yourkit (evalation version should fine) has more light weight recording, can have same issues.

flash - Singleton Conflicts and Order in AS3 -

if multiple instances of singleton trying update same property simultaneously, there conflicts? how as3 handle order? flash single-threaded.. write order issue when becomes multi-threaded? apologies awkward wording - i'm new oop , design patterns, , still grasping basic. 'scuse newbieness... your question isn't worded - there lot of issues here, think understand you're saying. it's best start definition of singleton - singleton class allows 1 object instance made. such, cannot have multiple singletons. referring multiple references singleton object, though, make sense. as question - won't run 2 simultaneous updates, flash runs in single thread , sequential. thus, though as3 allows asynchronous events, 1 thing ever happens @ 1 time. as such, there won't conflict - singleton property reflect whatever touched last, if updates millisecond apart. hope made sense.

android - Can multiple ContentProvider's serve the same URI? -

when querying contentprovider on android, 1 specifies contentprovider of interest providing "content uri" contentprovider. happens when multiple contentprovider's serve same uri, either intentionally? or maliciously? when trying open pic on phone, i've seen prompt apps can "handle" image. same kind of thing happen here? multiple contentproviders can't this. first application registers content provider using element in manifest has control on uri pattern. i'm pretty sure you'll installation error if try add provider uses same uri pattern. android keeps track of providers , uris. when see prompt multiple apps handling file or situation, that's because apps have specified child includes android.intent.category.category_alternative or android.intent-category.category_selected_alternatve. in essence, app or apps declaring alternatives action specified in child. allows user have multiple choices handling type of data. it make...

python - Unicode and UTF-8 encoding issue with Scrapy XPath selector text -

i'm using scrapy , python (as part of django project) scrape site german content. have libxml2 installed backend scrapy selectors. if extract word 'hüftsitz' (this how displayed on site) through selectors, get: u'h\ufffd\ufffdftsitz' (scrapy xpath selectors return unicode strings). if encode utf-8 , get: 'h\xef\xbf\xbd\xef\xbf\xbdftsitz' . , if print that, 'h??ftsitz' isn't correct. wondering why may happening. the character-set on site set utf-8 . testing above on python shell sys.getdefaultencoding set utf-8 . using django application data xpath selectors written mysql database utf-8 character set, see same behaviour. am overlooking obvious here? clues or appreciated. u'\ufffd' "unicode replacement character" , printed question mark inside black triangle. not u umlaut. problem must somewhere upstream. check encoding web page headers being returned , verify in fact, says is. the unicode replaceme...

c# 4.0 - ASP.NET DropDownBox has "Text" for both Text and Value properties -

okay, feel missing simple here. have asp.net dropdownlist control: <asp:dropdownlist id="rightcolumndropdownlist" runat="server"></asp:dropdownlist> in code behind, have (simplified, still has problem): protected override void onprerender(eventargs e) { listitemcollection options = new listitemcollection(); options.add(new listitem("name", "value")); this.rightcolumndropdownlist.datasource = options; this.rightcolumndropdownlist.databind(); } however, resulting rendered html has options contain "name" both value , text of option element. <option value="name">name</option> what missing here? tried no avail: options.add(new listitem(){ text= "name", value = "value"}); options.add(new listitem { text= "name", value = "value"}); and try specifying datavaluefield , datatextfield properties: leftcolumndropdownlist.data...

syntax - Is there a Hive equivalent of SQL "not like" -

while hive supports positive queries: ex. select * table_name column_name like 'root~%' ; hive does not support negative queries: ex. select * table_name column_name not 'root~%' ; does know equivalent solution hive support? check out https://cwiki.apache.org/confluence/display/hive/languagemanual if haven't. reference time when i'm writing queries hive. i haven't done i'm trying match part of word, might check out rlike (in section https://cwiki.apache.org/confluence/display/hive/languagemanual+udf#relational_operators ) this bit of hack job, sub query check if matches positive value , case ( http://wiki.apache.org/hadoop/hive/languagemanual/udf#conditional_functions ) have known value main query check against see if matches or not. another option write udf checking. i'm brainstorming while sitting @ home no access hive, may missing obvious. :) hope helps in fashion or another. \^_^/ edit: adding in addit...

hadoop - Any Good Opensource Analytics front end tool? -

is there open source web-based front end analytics tool can talk hive/hdfs data ? two became aware of are: http://www.jaspersoft.com/ http://datameer.com/products/das-for-hadoop-users.html i don't have lot of info on these yet, have begun researching them, but... it's 2 i'm aware of , wanted share. update: found out snowfinch , wanted include in answer

c# - Parse JSON block with dynamic variables -

i'm grabbing json object url , parsing json.net. able parse blocks of data defined variables fine, when comes random collection of var:value - i'm stuck. example(loosely typed): {"fname":"joe","lname":"doe", "bodytype":{"height":180,"weight":"200","race":"white","hair":"black"}, "belongings":{"shirt":"black","money":15,"randomthing":"anyvar"}, "signs":{"tattoo":0,"scar":"forehead","glasses":"dorky"} } i'm casting to class person { public string fname; public string lname; public bodytype bodytype; public ????? belongings; public ????? signs; } how handle belongings , signs if cannot predict properties? well, they're sure json objects, right, , json objects associative arrays mapping strings so...

How to handle multiple object TYPES within one array for android listview adapter? -

i building listview in android. have 5 different lists. mylistadapter extends baseadapter{ arraylist object1array<object1> = new arraylist<object1>(); arraylist object2array<object2> = new arraylist<object2>(); arraylist object3array<object3> = new arraylist<object3>(); arraylist object4array<object4> = new arraylist<object4>(); arraylist object5array<object5> = new arraylist<object5>(); public view getview(int position, view convertview, viewgroup parent) { if (convertview == null) { .... inflate layout xml } .... i have built adapter in above manner. in case instead of 1 single data set have 5 different list rendered using same listview. reason behind using 1 listview scrolling. dont want 5 different scrolls. i need render object1array , when reach end of list append object2array , on. i solu...

c - KeyboardHookProc in DLL doesn't do anything when called from python -

i've been trying write dll in c. install hook sets keyboardproc. calling installhook() , uninstallhook() functions python returns 0, guess because callback function keyboardproc isn't working. the following c code dll: #include "stdafx.h" #include <windows.h> #include <string.h> #include <ctype.h> #include <stdio.h> #include "ourdll.h" //#pragma comment(linker, "/section:.shared,rws") //#pragma data_seg(".shared") hhook hkeyboardhook = 0; int keypresses = 0; hmodule hinstance = 0; //#pragma data_seg() bool winapi dllmain (handle hmodule, dword dwfunction, lpvoid lpnot) { hinstance = hmodule; //edit return true; } lresult callback keyboardproc(int hookcode, wparam vkeycode, lparam flags) { if(hookcode < 0) { return callnexthookex(hkeyboardhook, hookcode, vkeycode, flags); } keypresses++;; return callnexthookex(hkeyboardhook, hookcode, vkeycode, f...

apache - .htaccess rewrite regex regular expressions -

my url is: http://www.domain.com/seattle_wa_math it needs point to: http://www.domain.com/list.php?city=seattle&state=wa&s=math here's have far, doesn't work... rewriterule ^[a-za-z_\-]+_[a-z]{2}_[a-za-z0-9_\-\(\)]+\/$ list.php?city=$1&state=$2&$s=$3 [l] this should it: rewriterule ^([a-za-z\-]+(?:_[a-za-z\-]+)*)_([a-z]{2})_([a-za-z0-9_\-\(\)]+)\/?$ list.php?city=$1&state=$2&$s=$3 [l] allows multiple worded citys , subjects , optional trailing / path.

php - How to delete folder with files using Google Storage REST api? -

i trying delete _$folder$ google storage using rest api. have tried far headerserver.com/testestset/* , headerserver.com/testestset , headerserver.com/testestset_$folder$ neither seem work when there files in folder. the approach came far foreach objects under _$folder$ before attempting delete it, however, highly inefficient. in worst scenario: possible batch/delete more 1 file per 1 request? unfortunately, there no other way other deleting objects withig directory or _$folder$ object.

php - on click change questions displayed -

i have page has list of items. on bottom of page "view more" button. when clicks button, page needs add more items. var $displayedquestions, , page coded right refresh when "view more" button clicked, we'd have live. how can done? here code: <?php include "db_connect.php"; db_connect(); function tags($tags) { $tagarray=explode(",",$tags); $i=0; $finished='false'; while($finished=='false') { if (empty($tagarray[$i])=='true') { $finished='true'; } else { $taglist = $taglist . '<a class="commontagnames" href="">' . $tagarray[$i] . '</a> &nbsp;'; $i++; } } return $taglist; } function formattime($timesince) { $strsince=number_format($timesince,0,'',''); $nodecimals=intval($strsince); if ($nodecimals<1){ return "less minut...

c99 - Any way to to include original parameters in fscanf in C -

i'm trying see if when do fscanf(inputstream, "$%s$", out) i can return $ signs - there way? i don't think there's way retrieve string dollar signs , non-blank string between them using scanf() family of functions. closest approach using scanset, scansets not same regular expressions, , you'd need regular expression specify pattern looking for. in practice, first dollar sign string using: fscanf(inputstream, " %1[$]%[^$]%*[$]", &out[0], &out[1]); you can't pull same stunt latter dollar sign, if know exact length of string. trouble you'd need overwrite null @ end of string second dollar sign, , you'd want nul '\0' after string. adding final dollar easier inserting first @ beginning of string. third scanset contains assignment-suppressing ' * ' , requires dollar @ end. leading space in format skips spaces. this isn't guaranteed behaviour; first conversion write nul on out[1] , ,...

c# - How to add a checkbox control to a datatable? -

how can add checkbox datatable , bind datagrid? datatable columnlist = new datatable(); columnlist.columns.add("column fields"); int j = 1, = 0; checkbox colcheckbox = new checkbox(); foreach (columns col in columnnames) { colcheckbox.name = col.columnname; columnlist.rows.add(colcheckbox); // getting displayed system.windows.forms.checkbox,checkstate=0 } please help. you'll have have boolean field (column) in datatable. when bind datatable datagridview, checkbox column created boolean field. sample code: var dt = new datatable(); dt.columns.add(new datacolumn("selected", typeof(bool))); //this show checkboxes dt.columns.add(new datacolumn("text", typeof(string))); //this show text var dgv = new datagridview(); dgv.datasource = dt; this bind dt datatable dgv datagridview. datagridview automatically display datagridviewcheckboxcolumn first datacolumn ( selected ) , datagridviewtextboxcolumn second datacolu...

yahoo pipes - Regex Replace A Word In Parentheses INCLUDING The Parentheses -

in yahoo pipes i'm struggling find way of removing brackets around word, word itself. how replace "(active)"? \(active\) escape ( , ) characters.

What is the significance of class data type in java? -

noob question. i have been programming @ basic level quite while have trouble understanding class data type. when int = 9; means of data type int meaning can contain integers. like wise string, boolean, double, float etc. but consider following code: class node { node next = null; int data; public node(int d){ data = d; } void append(int d) { blah blah blah .............. } } what node next = null; mean? can understand effort create object with node next = new node(); and try manipulate next object. this code: node next = null; declares variable of type node . node class, value of next reference - either object of type node or subclass, or null reference doesn't refer object @ all... , in case variable starts off value of null . it's important understand value of next never node object itself... it's ever reference. suppose have: node next = new node(10); node foo = next; here, next , foo separate ...

Java program to describe SQL Server Stored Procedure -

i trying write java program describe sql server stored procedure. here have input stored procedure name, need sp parameters , return types , lengths.. can helpme out.. get sp name dbo.sysobjects table get sp parameters/columns dbo.syscolumns table. use pubs -- list stored procedures 列出所有存储过程 select * dbo.sysobjects objectproperty(id, n'isprocedure') = 1 -- parameters/columns of stored procedure 'dt_checkinobject' 获取存储过程'dt_checkinobject'的所有参数 select * dbo.syscolumns c join dbo.sysobjects o on c.id=o.id 1=1 , objectproperty(o.id, n'isprocedure') = 1 and.o.name='dt_checkinobject'

java - selectBooleanCheckbox in icefaces -

<ice:column style="width: 30px;"> <f:facet name="header"> <ice:selectbooleancheckbox value="#{createtoolsorderinwardsbean.test}" partialsubmit="true" valuechangelistener="#{createtoolsorderinwardsbean.selectinwardquantitychk}" id="slc-tlmanage-selectallee"></ice:selectbooleancheckbox> </f:facet> <ice:selectbooleancheckbox value="#{currentrow.chkinwardquantity}" immediate="true" partialsubmit="true" style="margin-left: 10px;" id="slc-tlmanage-enableinput"></ice:selectbooleancheckbox> </ice:column> i have code whtin ocefaces datatable.when select first 1 other checkbox w...

objective c - Iphone Custom Navigation Bar - White Box Error -

my problem simple. used method of subclassing navigation bar, , using drawrect attempt draw own custom navigation bar image. however, doesn't draw image... blank white space. the structure of project tab bar navigation controller under each 1 of it's tabs. each navigation controller has navigation bar , have set bars custom class (customnavbar) in ib. in customnavbar.h file have: @interface customnavbar : uinavigationbar { } @end in customnavbar.m file have: #import "customnavbar.h" @implementation customnavbar -(void) dealloc{ [super dealloc]; } - (void)drawrect:(cgrect)rect { uiimage *image = [uiimage imagenamed:@"navigation_bg.png"]; [image drawinrect:cgrectmake(55, 0, self.frame.size.width, self.frame.size.height)]; } @end any ideas why image might not showing , instead getting white background? image in project under resources folder. thank everyone. :) when implemented code in test project, did in fact see ...

postgresql - Postgres LIKE operator question -

so let's have function takes in 1 parameter create function(i_param varchar) i want select 1 table where col_name 'i_param%' i tried doing like i_param||'%' think literally returns string 'i_param' not value put function. it doesn't give me errors returns 0 rows. how like on input parameter? pretty new stuff, great! thanks! as note, starting in 9.2, can things way are. in previous versions, should error instead. the fact didn't error suggests use of i_param in colliding column name. recommend prefixing input variables reason (i use "in_" in work). for example, if you: create table foo ( foo text, bar text ); then following not generate error: create function search_foo(bar text) returns setof foo language sql $$ select * foo foo ilike bar || '%'; $$; however in fact comparing column foo against column bar. following give errors: create function search_foo(in_bar text) returns set...

c++ - How do I set the number of visible lines in a Gtk::TextView? -

i have gtk::textview have 2 lines of text visible, regardless of font size. if more 2 lines entered box scroll i'd text view remain 2 lines tall. how do this? this difficult. example, if 2 font sizes mixed in 1 line? one way create pango layout of 1 letter , find out height. untested simplification of code wrote in c 1 time; shouldn't trouble convert c++ , gtkmm: pangolayout *cell = gtk_widget_create_pango_layout(textview, "x"); int line_height; pango_layout_get_pixel_extents(cell, null, &line_height); g_object_unref(cell); gtk_widget_set_size_request(textview, -1, line_height);

c++ - Qt - Why won't my widgets line up using a vertical layout inside a splitter? -

Image
as per screenshot below, why won't widgets line using vertical layout inside splitter? /******************************************************************************** ** form generated reading ui file 'test.ui' ** ** created: tue apr 12 16:51:51 2011 ** by: qt user interface compiler version 4.6.2 ** ** warning! changes made in file lost when recompiling ui file! ********************************************************************************/ #ifndef ui_test_h #define ui_test_h #include <qtcore/qvariant> #include <qtgui/qaction> #include <qtgui/qapplication> #include <qtgui/qbuttongroup> #include <qtgui/qgridlayout> #include <qtgui/qheaderview> #include <qtgui/qlineedit> #include <qtgui/qlistwidget> #include <qtgui/qmainwindow> #include <qtgui/qsplitter> #include <qtgui/qtreewidget> #include <qtgui/qvboxlayout> #include <qtgui/qwidget> qt_begin_namespace class ui_mainwindow { p...

windows - swf to exe, real world experience -

i'm facing challenge of rebrushing , updating 10-years old screenweaver project, , looking decent modern swf-exe convertor. don't have time evaluate options , therefore i'd hear responses actual working experience such tool. since winapi interaction must, default projector not option. similar questions (no concrete answers there) package swf exe or app create exe swf using flex 3 without requiring air? many thanks upd: 300 bounty can me practical answer. i've been experimenting different swf projectors long time now, , far think i've tried if not of them. i've explained in more detail best projectors have used below. mdm zinc http://www.multidmedia.com/software/zinc/ i remember in when had vista mdm had quite few bugs running under os. took while them fix bugs - bugs didn't stop running, interfered functioning of methods in program. reason, decided not continue testing zinc , moved on projector. saying though, i'm have fix...

installer - WiX: Bundling dependencies inside MSI using Burn -

i use burn tool wix v3.6.1601.0 create bootstrapper download project dependencies (.net 3.5). end result 2 executables (a program msi , exe download dependencies). since many of customers seams not understand executable use, make simpler shipping 1 file (i.e. msi). is possible burn ?, , if can point me documentation on how create single msi bootstrap own dependencies. msi packages can't bootstrap other installers except through use of "embedded chainers." (see msi sdk topic on msiembeddedchainer.) burn creates .exe contains msis , other prerequisites.

list - How to show a default selecteditem in a flex combobox -

in flex application how display default selecteditem dataprovider of combobox. i'm using {staticdataholder.currencylist}. for example: have show india should selected default list. where india 1 of value in currencylist. all suggestions welcome. thank you. you need loop through dataprovider , set selected object: example: for each ( var obj:object in staticdataholder.currencylist ) { if ( obj == "india" ) { cbx.selecteditem = obj; break; } }

html - JavaScript: Get image dimensions -

i have url image. need determine height , width of image using javascript. image cannot visible user on page. how can dimensions? var img = new image(); img.onload = function(){ var height = img.height; var width = img.width; // code here use dimensions } img.src = url;

html - Looking for javascript event equivalent to 'onRender' -

i'd add <td> element js event listener triggered when page rendered (or loaded) dom , td contains innerhtml value. like: <script> function manipulate(field){ field.value = field.value+'_done'; } </script> <td onrender=manipulate(this)>hello world</td> i can't use onload because can used in <body> understanding there way it? you can still use body's onload, fire when complete page ready , loaded. can set attribute every td element you'd manipulate, , traverse page find elements , call function. why want manipulate after dom loaded?

nhibernate collection set mapping to avoid n+1 select and duplicate rows with fetch join -

i have object table , object aliases table. the aliases set collection of strings: object.aliases if map collection this: <class name="object" table="object" lazy="false"> ... properties... ... <set name="aliases" table="aliases" inverse="true" lazy="false" fetch="join" > <key column="objectid" /> <element column="name" type="string"/> </set> ... </class> then session.createcriteria(typeof (t)).list<t>(); from base repository fetches objects, returns duplicates each alias. why? how can rid of duplicate objects in list? thank time. edit: updated mappings... that's mappings. aliases doesn't have it's own class it's set of strings needs loaded iset<string> object.aliases i confused this, too, when started using nhibernate. that's how works. becau...

Finding out the interfaces/protocols a Clojure Record/Type implements? -

is there way can dynamically find out interfaces or protocols clojure record or type implements? for example do: (show-protocols some-record-instance) look following article - answers question

Eclipse PHP - How to make the comment styling agree with Doxygen -

i'm using doxygen eclox plug in on eclipse helios php project. nearly fine, but: the eclipse auto comment system generates style: * @param typename $parametername ...whereas doxygen expects opposite: * @param $parametername [typename] (actually, doxygen doesn't know type names in php, far can see - use convention of making them first word of comment). not mean i'm continually having delete "unknown_type" eclipse puts in, uses variable names comments in outline generator (rather variable names in code). having set comments work doxygen, outline generator has lost parameter names. does know how set eclipse/eclox/doxygen differently? this feature implemented in recent releases of doxygen. see https://bugzilla.gnome.org/show_bug.cgi?id=613185 @var , @return still not supported.

Dynamic positioning of a Button [Android] -

i have relativelayout holds imageview , imagebutton. imageview serves container background image. i'm trying set button @ fixed position appears on same position on background image. here layout file i'm using: <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/relativelayout1" android:layout_height="match_parent" android:layout_width="match_parent" android:gravity="center_horizontal"> <imageview android:src="@drawable/bg_1" android:id="@+id/imgview" android:adjustviewbounds="true" android:layout_height="match_parent" android:layout_width="match_parent" /> <imagebutton android:layout_width="120dp" android:background="@drawable/button_1" android:layout_height="30dp" android:id="@+id/imgbutton" and...

UIWebView autorotation bug? -

please, in problem: i have uiwebview subview @ viewcontroller.view, , has autoresizing set fit screen bounds in orientation. problem is: rotation works properly, if zoom out, , rotate, uiwebview frame sets right, content still in landscape. seems uiwebview bug, maybe know solution. p.s. webview.scalespagestofit = yes; without pinch (to zoom out), works great. i've attached video link, make problem more clear (autoresizing mask visible in ib). http://dl.dropbox.com/u/11819370/bugs/rotationbug.mov thanks. try using these: [self.view setneeddisplay]; [self.view setneedslayout];

Delete a liferay portal instance -

is there way delete portal instance created in liferay 6?? no, there no way delete portal instance in liferay 6.0. might change in further releases (see comments below feature request: http://issues.liferay.com/browse/lps-14023 )

java - Best way to generate MBeans for managing an XML File -

i have xml file defined xml schema. need manipulate java code. need enable remote clients manipulate via jmx. anyone got suggestions? this sounds xml file used configuration. use jaxb generate java bindings use appropriate tool expose java objects generated in 1) jmx mbeans (spring jmx, model mbeans, etc)

haskell - Gtk Terminal Widget -

simple question: there linux-style terminal widget gtk? preferably haskell, too, want use gtk2hs vte used in gnome-terminal. seems there vte haskell bindings .