Posts

Showing posts from February, 2010

javascript - Anchor with "computed" URL -

i have js script appends html page pairs: input + anchor can compute url before redirect happens? now have link looks this: <a href="#" onclick="myfunct();return false;">link</a> and myfunct uses window.location.href redirect webpage. problem approach cannot (obviously) ctrl+click on link opening goal link in new tab. details: the link url known after obtaining url server - operation expensive me , in case absolutely necessary. the idea is: user chooses link, he/she clicks it, url obtained server , user redirected (in same window or in new tab if he/she uses ctrl+click) thanks! im not entirely looking try giving anchor id <a href="#" id="mylink">link</a> then update href attribute change new location (perhaps on change on input ? <input onchange="changelink(this)" value="http://www.google.com/"/> function changelink(elem) { var mylink = document.geteleme

sql - C#-Alter table tname add column cname Long Integer NOT NULL-throws exception -

i creating tables , column dynamically. first creating tables , adding columns in them alter table. but whenever alter table tname add column cname long integer not null is executed, shows error in alter table statement. and when there decimal(28,0) not null , column added. database ms-access , using c# what wrong long int in jet sql language there isn't long integer database type. specify long or integer. i have tried sql statement access query builder , doesn't syntax. right, if remove ending not null accepts statement although looking here not seem valid syntax.

algorithm - good graph/complex networks libraries -

i looking recommendation graph analysis libraries or framework,better in c++ or java. have found graph libraries, https://stackoverflow.com/questions/3010805/scalable-parallel-large-graph-analysis-library this webpage gives possible solutions: • c++ -- viable solutions appear boost graph library , parallel boost graph library. looking @ mtgl, although slanted more toward massively multithreaded hardware architectures cray xmt. lastly, i've added lemon list consideration. • c - igraph , snap (small-world network analysis , partitioning); latter uses openmp parallelism on smp systems. • java - have found no parallel libraries here yet, jgrapht , perhaps jung leading contenders in non-parallel space. • python - igraph , networkx solid options, though neither parallel. there used python bindings bgl, these unsupported; last release in 2005 looks stale now. but not sure 1 should use based on own need: good data structure , algorithm. can analysis properties of com

php - Facebook app permissions error -

i have code facebook web app: <?php if (!$user_profile) { ?> <div class="fb-login-button" data-perms="email,user_birthday,publish_stream">login facebook</div> <?php } else { ?> user profile <pre> <?php //print htmlspecialchars(print_r($user_profile, true)) ?> </pre> <?php echo $user_profile['name']; ?> <?php $data = array("message" => "hello woghfd!"); $status = $facebook->api("/me/feed", "post", $data); //echo $user; ?> <?php } i have code, simple thing post users wall. know need permission of publish_stream, ive included in button (at top) when user visits site error: fatal error: uncaught oauthexception: (#200) user hasn't authorized application perform action now when user logs out of facebook via facebook, , logs in using login button

php - Redirect mobile users based on country and carrier -

anyone knows easy way preferably php achieve this. want redirect mobile visitors based on country , carrier (like t-mobile or vodafone). in advance there html5 network information api: http://dvcs.w3.org/hg/dap/raw-file/tip/network-api/index.html not sure if can carrier information though know carriers offer html5 api's of there own might take advantage of: http://developer.att.com/developer/forward.jsp?passeditemid=9700222 also there html5 geolocation api http://dev.w3.org/geo/api/spec-source.html more examples: http://www.html5rocks.com/en/mobile/optimization-and-performance/ as php solution carrier lookup, there no free solutions can try this: http://www.data24-7.com/carrier24-7.php but work need obtain users phone number which: html5 thankfully can not php thankfully can not the user have manually enter number or develop native app have access device number

c# - Restart an application by itself -

i want build application function restart itself. found on codeproject processstartinfo info=new processstartinfo(); info.arguments="/c choice /c y /n /d y /t 3 & del "+ application.executablepath; info.windowstyle=processwindowstyle.hidden; info.createnowindow=true; info.filename="cmd.exe"; process.start(info); application.exit(); this not work @ all... , other problem is, how start again this? maybe there arguments start applications. edit: http://www.codeproject.com/script/articles/articleversion.aspx?aid=31454&av=58703 i use similar code code tried when restarting apps. send timed cmd command restart app me this: processstartinfo info = new processstartinfo(); info.arguments = "/c ping 127.0.0.1 -n 2 && \"" + application.executablepath + "\""; info.windowstyle = processwindowstyle.hidden; info.createnowindow = true; info.filename = "cmd.exe"; process.start(info); appli

ios - Get the CGRect frame of the inner contentView of a UINavigationController during or before loadView -

apple's docs say: note: because amount of space available custom view can vary (depending on size of other navigation views), custom view’s autoresizingmask property should set have flexible width , height. before displaying view, navigation controller automatically positions , sizes fit available space. that's great, except ... need know size uinavcontroller use before view added frame, because content i'll displaying different depending on size. this inside "loadview" method of uiviewcontroller that's being added uinavigationcontroller. well, technically shouldn't sizing subviews in loadview method. don't use nibs, , in of view controllers loadview small: self.view = [[uiview alloc] init]; . then, in viewdidload add subviews self.view . finally, of resizing in viewwillappear , because @ point self.view appropriate size. if must size views in loadview method, you'll have calculate out dimensions manually...i.e: find

Google Maps - search within bounds / viewport -

i want search return hits within map/viewport. zoom in on britain , search london map bounds, response return 3 hits in us. how limit search? code: function codeaddress(){ geocoder = new google.maps.geocoder(); var address = document.getelementbyid("inputaddress").value; var bounds = map.getbounds(); geocoder.geocode({address: address, bounds: bounds}, function(results, status){ if(status == google.maps.geocoderstatus.ok){ // put markers on each hit } }); } i'm assuming limiting results trying plot relevant markers right? so instead of limiting search directly, can try indirect approach. if(status == google.maps.geocoderstatus.ok){ // put markers on each hit } in if loop can use method called contains() on bounds of map, so if(status == google.maps.geocoderstatus.ok) { if(map.getbounds().contains(result-location)) { // put markers on each hit } }

xaml - Silverlight Change Content Based on Control CheckState (Toggle multiple ContentPresenters) -

i change content of control based on current checkstate (checked, unchecked, indeterminate). if possible solution use xaml , require no code behind. i wondering control use , how define multiple sets of content. example: "togglecontent" control displays usercontrol1 when checked state unchecked , usercontrol2 when checked state checked. the xaml might this: <togglecontent> <togglecontent.contentunchecked> <local:usercontrol1></local:usercontrol1> </togglecontent.contentunchecked> <togglecontent.contentchecked> <local:usercontrol2></local:usercontrol2> </togglecontent.contentchecked> </togglecontent> i'm not sure "no code behind" means, sounds perfect example using valueconverter , changing visibility based on check state. this: <stackpanel> <checkbox x:name="mycheckb

ios - What are the implications of the higher dpi screen on the iPad 3 for assets? -

obviously apple released new ipad . far developers concerned, implications adding new assets support retina , non-retina displays across ipad models? same @2x model implemented on iphone 4 , 4s? if have foo.png name call different size versions worked in universal app across ios devices? it solved doing said, @2x device modifier, since have doubled number of pixels. writing myimage@2x~ipad.png . applications running in ios 4 should include 2 separate files each image resource. 1 file provides standard-resolution version of given image, , second provides high-resolution version of same image. naming conventions each pair of image files follows: standard: <imagename><device_modifier>.<filename_extension> high resolution: <imagename>@2x<device_modifier>.<filename_extension> the <imagename> , <filename_extension> portions of each name specify usual name , extension file. <device_modifier> port

javascript - Get last row of table attribute -

var table = document.getelementbyid(table1); var lastrow = table.rows.length; var country = lastrow.getelementbyid('country'); country.setattribute('class', "country"+lastrow); im pretty new , wondering if possible? instead of var country= document.getelementbyid('country'); as have other id=country because adding new rows.. edit i know id unique. cloning last row of course ids same. an id in html document unique. hence there no need sub-queries in order find elements. instead use document.getelementbyid('country')

python - Can't get canvas to draw fig in matplotlib -

from basic understanding using matplotlib store desired plt in 'fig' , can draw said 'fig' using canvas.draw() operation. if case shouldn't have problems since do, going on , what's logic behind getting on canvas. also, end goal display plot within qtpy window. results far can window , canvas show canvas shows empty. have been looking @ http://matplotlib.sourceforge.net/users/artists.html , feel i'm doing isn't entirely wrong, perhaps i'm overlooking nuance. here code i'm referencing: def drawthis(self): self.axes.clear() self.axes.grid(self.grid_cb.ischecked()) self.fig = plt.figure(figsize=(11,7),dpi=self.dpi) file = filelist[selfile] valid = [scolumn] matrix = np.loadtxt(file, skiprows=1, usecols=valid) colcount = np.loadtxt(file, dtype=object) totalcols = colcount.shape[1] kdedata = np.array(matrix) datarange = (decimal(max(abs(kdedata))) / 10).quantize(1

Avoid multiple outputs of same record in MySQL -

i have query works multiple conditions when selecting record. select uid, uid2, up, datediff(current_timestamp, tim) \"dt\", id, behind, sid, spid z_uup, z_snoop, z_wshop (z_wshop.sid='5555' or z_snoop.id='5555' ) , ( z_uup.uid=z_snoop.id or z_uup.uid2=z_snoop.id or z_uup.uid=z_snoop.behind or z_uup.uid2=z_snoop.behind or z_uup.pid=z_wshop.spid ) order z_uup.tim desc; the table z_uup has single entry seems 15 repetitions of same out put. why happening , how can solve this. did try using distinct? select distinct field1, field2, ... table1... that way repeat records not displayed. if makes slower, try group field z_uup.

cmake - Rename the output of CPack -

i rename installer file cpack (v2.8.7) produces include version number obtained @ build time version control system. appears cannot be done setting cpack_* variables because happens @ "cmake" time. what want able run "(n)make package" , have installer file created no further commands required. 2 possible approaches aware of manipulating cpack filename variables @ build time , renaming final output of cpack. if using "include(cpack)" in cmakelists.txt file appears cpack runs last , can't have post-build command. this mailing list message suggests custom target can written run cpack, unable figure out how without creating infinite recursion. how can done? with bit of cmake mailing list figured out how it, using subversion. cmakelists.txt cmake_minimum_required(version 2.8) project(myapp) add_executable(main main.cpp) install(targets main destination .) add_custom_target(first # update working copy command ${subversion_sv

c# - Fire Job only one time at specific date and time -

i have code job - log info database public class job : ijob { private static readonly log4net.ilog log = log4net.logmanager.getlogger(system.reflection.methodbase.getcurrentmethod( ).declaringtype); #region ijob members public void execute(ijobexecutioncontext context) { // job prints out job name , // date , time running jobkey jobkey = context.jobdetail.key; log.infoformat("simplejob says: {0} executing @ {1}", jobkey, datetime.now.tostring("r")); } #endregion } my singleton scheduler class public class scheduler { static scheduler() { namevaluecollection properties = new namevaluecollection(); properties["quartz.scheduler.instancename"] = "myapp"; properties["quartz.scheduler.instanceid"] = "myapp"; properties["quart

java - Calling SQL Server stored procedure using JDBC/ODBC -

i want update table using store procedure. try { class.forname("sun.jdbc.odbc.jdbcodbcdriver"); connection con = drivermanager.getconnection("jdbc:odbc:karthi","sa",""); string query=("{call supdate set=(?,?,?,?,?,?,?,?) where="+value1+"}"); callablestatement statement = con.preparecall(query); statement.setstring(1, value2); statement.setstring(2, value3); statement.setstring(3, value4); statement.setstring(4, value5); statement.setstring(5, value7); statement.setstring(6, value8); statement.setstring(7, value9); statement.setstring(8, value10); statement.execute(); }catch(exception e ) { system.out.println(e.getmessage()); } i get [microsoft][odbc sql server driver]syntax error or access violation

java - Hibernate dialect not defined error -

i have been facing issue application , not know wrong: exception in thread "main" org.springframework.beans.factory.beancreationexception: error creating bean name 'auditeventmanager' defined in class path resource [manager-service.xml]: cannot resol ve reference bean 'transactionmanager' while setting bean property 'transactionmanager'; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name ' transactionmanager' defined in class path resource [manager-persistence-standalone.xml]: cannot resolve reference bean 'sessionfactory' while setting bean property 'sessionfactory'; nested exceptio n org.springframework.beans.factory.beancreationexception: error creating bean name 'sessionfactory' defined in class path resource [manager-persistence.xml]: invocation of init method failed; nested exception org.hibernate.hibernateexception: 'hibernate.dialect' must set when no

jquery - How does $('<html><head>...</head><body>...</body></html>') work? -

i still trying create full dom document string. got bunch of interesting suggestions on this other question , none fits i'm looking for. i'm trying understand how things work maybe find solution. we need replace lot of jquery code 'native' javascript. jquery, able $('<html><head>...</head><body>...</body></html>') , perform operations on nodes of object, search them... etc. what jquery do? create new document? append existing one? since lot of people question our replacement of jquery, here little more details: building chrome application make use of content script. if jquery lightweight, it's not kind of add couple mb of memory consumed in each tab few jquery methods. jquery is awesome , fits many many needs, not ours. you can find answer in jquery source . start out core.js , you'll find init method. if follow logic there, you'll see nontrivial elements it'll call jquery.buildfragment ,

r - Is it ok to use transform to add per row results of operation on data.frame? -

i'm bit confused. routinely use transform this ddply(data.frame, 1, transform, new.column = function(old.col.1,old.col.2,...)) this recommended hadley . but i asked question , hadley stated this: don't use transform. it's helper function suitable interactive use, not programming with. so whats wrong transform? think im convinced stupid: transform(data.frame,col2=fun(col1)). but not useful in ddply setting? there's difference between using transform within ddply , function transform() standalone. far better (and quicker) do: mydata$col3 <- fun(mydata$col1, mydata$col2) the function combination ddply/transform useful if have more 1 column change, eg mynewdata <- ddply(mydata,1,transform,col3=fun1(col1,col2), col4=fun2(col1,col2)) and then, have more flexible option of using within() allows use calculated results calculate next row: mynewdata <- within(mydata,{ col2 <- fun1(col1) col3 <- fun2(col1,

android - how to add view to random position so that i can swipe to left and right direction of View Pager? -

my scenario is, have list view many data . , when user click on it. navigate detail page view pager implemented.when user click on 10th item of list view navigate detail page problem "i unable swipe left though have 9 item previously???" if (collection != null) { view = (mycustomscrollview) ((activity) ctx).getlayoutinflater() .inflate(layoutid, null); ((viewgroup) collection).addview(view,0); holder = new viewholder(collection); collection.settag(holder); } here view added 0th position. how can add view selected position??? note :when replace 0 selected position of listview. compiler throws java.lang.indexoutofboundsexception: index=2 count=0 ???

perl - WWW::Mechanize ignores base href on gzipped content -

as title says www::mechanize not recognize <base href="" /> if page content iz gzipped. here example: use strict; use warnings; use www::mechanize; $url = 'http://objectmix.com/perl/356181-help-lwp-log-after-redirect.html'; $mech = www::mechanize->new; $mech->get($url); print $mech->base()."\n"; # force plain text instead of gzipped content $mech->get($url, 'accept-encoding' => 'identity'); print $mech->base()."\n"; output: http://objectmix.com/perl/356181-help-lwp-log-after-redirect.html http://objectmix.com/ <--- correct ! am missing here? thanks edit: tested directly lwp::useragent , works without problems: use lwp::useragent; $ua = lwp::useragent->new(); $res = $ua->get('http://objectmix.com/perl/356181-help-lwp-log-after-redirect.html'); print $res->base()."\n"; output: http://objectmix.com/ this looks www::mechanize bug? edit 2: lwp or

c# - adding Hyperlink in win app -

i'm looking way use hyperlinks in winforms environment. i found uses system.web.ui.webcontrols ; when tried use in program system.web far go. checked refrences no system.web.ui.webcontrols or that, sugestions? if your're developing winforms application have use system.windows.forms.linklabel control, located in system.windows.forms assembly. controls in system.web.* html pages.

jquery - How to clear File Input -

below part of jquery code have displays file input , "clear file" button. var $imagefile = $('<input />').attr({ type: 'file', name: 'imagefile', class: 'imagefile' }); $image.append($imagefile); var $imageclear = $('<input />').attr({ type: 'button', name: 'imageclear', class: 'imageclear', value: 'clear file' }); $image.append($imageclear); now reason have "clear file" button because if click on button, clear in file input. how code clears file input when click on "clear file" button? this should work: $imageclear.on('click', function() { $imagefile.val(''); });

SSIS Package - Looping through folder to check if files exists -

can help: required: ssis package loop through folder (containing 100 files) , check whether required files (which 5/6) present in folder. does has code - checking multiple files existence in destination folder regards add foreach loop container control flow double click , select collection. on enumerator, select foreach file enumerator select folder , type of file select return type when file found. options whole filename including extension , path, name , extension or name of file found select checkbox if want subfolders click on variables option on left , new variable or select existing variable. at point have each file name on folder. prove it, add script component, double click it, , variable on read variable , click on edit script. make main this: public void main() { system.windows.forms.messagebox.show(dts.variables["filename"].value.tostring()); dts.taskresult = (int)scriptresults.success; } now, comparison can several ways. don

c# - event priority and process order -

is there way specify order or priority handle registered event delegates? example, have event processed before other events, want other objects allowed register listeners event well. how can accomplished? lets want proc1 run before proc 2. class messageprocessor { private dataclient client; public messageprocesser(dataclient dc) { client = dc; client.messagereceived += processmessage; } void proc1(messageeventargs e) { // process message } } class dataclient { public event messagereceievedhandler messagereceived; } void main() { dataclient dc = new dataclient(); messageprocessor syncprocessor = new messageprocessor(dc); // 1 high priority , needs process sync when arrive before data messages messageprocessor dataprocessor= new messageprocessor(dc); // 1 can process data has time when sync messages not being processed. // other stuff } the reason doing this, have server sending messages on udp s

vba - Providing status updates for macro that goes into not responding state until completion -

i have vba macro search through email archives. when searching through tens of thousands of emails, (or couple hundred on test machine) displays status few seconds, enters not responding state while running through rest of emails. this has led impatient users close out of task prematurely, , rectify providing status updates. i have coded following solution, , believe problem lies in way garbagecollector functions in vba during loop. public sub searchandmove() userform1.show ' send message user indicating ' program has completed successfully, ' , displaying number of messages sent during run. end sub private sub userform_activate() me.width = 240 me.height = 60 me.label1.width = 230 me.label1.height = 50 dim oselecttarget outlook.folder dim omovetarget outlook.folder dim osearchcriteria string ' select target folder search , folder ' files should moved set oselecttarget = application.session.pickfolder set omovetarget = applicatio

groovy script / java code to get distinct users from resultset -

hi run simple select query in oracle on table , resultset. select username, responsibility, project mytable. resultset contains user details. there multiple rows returned each username different values responsibility , project. want list of lists resultset has 1 list per username , distinct values concatenated in comma seperated string. if sam has multiple entries in resultset output of operation should give me: userlist = ["sam", "responsibility1,responsibility2,responsibility3...", "dept1,dept2,dept3.."], [some other user], [and on..] later write csv file. cannot in query compatibility reasons, have support multiple databases, versions in future. how do in java or groovy? thanks java quite easy. need class model each user. need map of username user. each user contains list of responsibility , list of departments. iterate resultset, find user map on each row , add responsibility , department user do need code or enough? hth

In Java, how is an Array of objects garbage collected? -

when array of objects not referenced anymore, objects in array garbage collected too? (assuming no variables referencing elements) in page, http://java.sys-con.com/node/37613 says - "the biggest danger placing object collection , forgetting remove it. memory used object never reclaimed." if make sure nullify references, why memory unclaimed? thanks when array of objects not referenced anymore, objects in array garbage collected too? (assuming no variables referencing elements) yes. "the biggest danger placing object collection , forgetting remove it. memory used object never reclaimed." this when are holding reference collection. example, if have map in put key-value , forget remove stays there ever. think http sessions, if use in servercontext or such @ start of request using session id key fail remove @ end of request processing..

rubygems - Why are rails gems not using the same gem and library names? -

maybe it's because it's late @ night, spent way long figuring out while gem activesupport , need require 'active_support' . same activerecord , actionmailer , , other rails libraries defined in https://github.com/rails/rails (so @ least it's internally consistent). is there historical reason this, or benefits it? historically, change deprecation warning going rails 3 (started in rails 2.3.2?). there no real advantage or anything. it's legacy (yes confusing). can see commit here adds deprecation warnings: https://github.com/rails/rails/commit/08d15f86c447fea31132d11df03ff5df41650f50#diff-2 devs cheering in comments. really renaming (or zero'ing out) lib/activerecord.rb lib/active_record.rb etc. that's history , no 1 liked it. lately, it's been less of hot topic since people have heard or run now. however, i'm sure i'd warning/error if upgraded 1 of old rails projects. sorry if annoying you, i've been there too.

Magento connect manager - Dangerous to install upgrades above Magento version? -

i'm wanting know if it's safe me upgrade of packages have upgrades available. magento version 1.6...but there seem upgrades include numbers 1.6.2.2 , 1.7 etc. thanks i think clean magento installation can upgraded through magento connect. other ways if not have unit , acceptance tests, it's risky use magento connect.

iphone - iOS 5.1 with Xcode 4.3.1: [UIColor colorWithPatternImage:] strange behavior only on device -

Image
when compile app in xcode 4.3.1 ios 5.1, notice there strange behavior background textures on actual device. there 1px gap in between texture tiles shown in screenshot below. my texture 150x150 , 300x300 @ 2x. so far i've tested same build on: simulator iphone/ipad both 5.0/5.1: no bug iphone/ipad running 5.0.1: no bug iphone/ipad running 5.1: buggy i've been getting same problem since 5.1 aswell. solved doing following image in photoshop. can same in tool. load file, select all, , copy clipboard create new file in photoshop same dimension, rgb , 8bit depth 72pixels/inch resolution white background. paste image copied in step 1 image save file , use one. after doing file displayed correctly on device , didn't have resort creating images size of display.

c# - MSbuild Package via Command line not including all my Assemblies -

i trying setup deploy script publish of our website rather have open vs deploy/publish. when publish via vs include referenced assemblies correctly when via command line not. @ lose missing my msbuild command is: msbuild "myproject.csproj" /t:package;resolvereferences /p:configuration=debug /p:deployonbuild=true /p:deploytarget=msdeploypublish /p:createpackageonpublish=true /p:msdeploypublishmethod=remoteagent /p:webprojectoutputdire="precompiled"

forms authentication - WCF CustomRoleProvider and Principle Permissions -

edit: think issue may related issue below i'm using ssl principalpermission.demand() failing once wcf service moved ssl i'm working on secure set of web services, i've implemented customroleprovider , custommembershipprovider in order authenticate users. this works great, restrict access majority of service calls if user not authenticated. i planned on using following accomplish this [principalpermission(securityaction.demand, authenticated=true)] however, doesn't seem detect when user authenticated , throws security exception. i'm not sure i've done wrong. public class custommembershipprovider : membershipprovider { public string usertype; public override bool validateuser(string username, string password) { //custom logic work out if user exists , password correct //if user exists , password matches populated user //object containing username , usertype if (user == null) {

SSIS connection dropped -

i have ssis package within data flow task fetches lot of data using oledb connection. when run package local machine fails following error (snippet): warning: 0x80019002 @ onerror: ssis warning code dts_w_maximumerrorcountreached. [..] error: 0xc0202009 @ dft transform, src bsasrel1 [1]: ssis error code dts_e_oledberror. ole db error has occurred. error code: 0x80004005. ole db record available. source: "microsoft ole db provider sql server" hresult: 0x80004005 description: "[dbnetlib][connectionread (recv()).]generel netværksfejl. [..] error: 0xc0047038 @ dft transform, ssis.pipeline: ssis error code dts_e_primeoutputfailed. primeoutput method on component "src bsasrel1" (1) returned error code 0xc0202009. component returned failure code when pipeline engine called primeoutput(). meaning of failure code defined component, error fatal , pipeline stopped executing. if deploy package server , run agent job nothing goes wrong. erro

asp.net - BindingInformation in Microsoft.Web.Administration -

i try create new site: servermanager iismanager = new servermanager(); site addedsite = iismanager.sites.add(sitename, sitefolder, 80); addedsite.serverautostart = true; iismanager.commitchanges(); and add site need have in iis binding information "test.com" how can add ? aslo somehow added site stopped... you can use following constructor set binding information. found msdn servermanager iismanager = new servermanager(); site addedsite = iismanager.sites.add(sitename,"http","*:80:www.example.com", sitefolder); where * server ip address bind hostname www.example.com, or leave * catch requests server ip.

What naughty word list is good to fight spam? -

i have simple spam filter mechanism in place uses list of naughty words spam (i use these post content user profile fields etc). i have: array ('shop','bags','shoes','shag','watches','sales','health','insurance','trader','wedding','casino','hack','ps3','cheap','episode','accessories','movie','nobod.info') what lists using? i'm adding/changing words time, seeing other lists big help! blacklisting words not work effectively. machine learning techniques useful here. is, @ messages marked explicitly spam, , let computer learn spam messages like. mail sites gmail use fight against spam. lot of work, reliable way fight spam (when last time saw spam in gmail inbox?) blacklisting words these have high false positive rate, annoying.

jQuery Plugin variable availability -

today first time, ran problem variables being mixed multiple instances of jquery plug-ins. a simple version of plug-in can viewed here: http://jsfiddle.net/jydzb/2/ i want able create timer in plugin, , access variable "mytimer" in method within plugin. in case, destroy it. however, thought sure creating variables did below "mytimer" made variable available in class/plugin? wrong? how use variables within plugin? know store them in $obj.data('',''), doesn't make sense when store in var. you see when run jsfiddle script, doesn't destroy timer. simple html write line every 5 seconds... destroy after 10:<br /> <hr /> <div id='mydiv' style='border: solid 1px #000;float:left;'></div> <div id='mydiv2' style='border: solid 1px #f00;float:right;'></div> jquery plugin if (jquery) ( function (jquery) { var mytimer; var methods =

.net - Why can't I match POSIX Character Classes -

the following snippet prints false : console.writeline(regex.ismatch("abc", @"[[:alpha:]]")); but prints true : console.writeline(regex.ismatch("abc", @"[a-za-z]")); why? shouldn't equivalent? .net regexes don't support posix character classes. support unicode groups. this work: regex.ismatch("abc", @"^\p{l}+$"); the \p{l} group matches unicode letters. see here more information: http://msdn.microsoft.com/en-us/library/20bw873z.aspx#categoryorblock

nhibernate - Crossjoin using QueryOver -

how replace hql query below using queryover api? var sql = "from role r, action r.active = :active , a.active = :active"; var result = manager.session.getisession().createquery(sql) .setboolean("active", true).list(); i don't believe there's way in queryover, since both joinalias , joinqueryover require expression describing path related entity. however, easy accomplish in linq-to-nhibernate: var result = (from role in manager.session.getisession().query<role>() action in manager.session.getisession().query<action>() role.active == true && action.active == true).tolist(); with nh 3.2, here's sql get: select role0_.id col_0_0_, action1_.id col_1_0_ [role] role0_, [action] action1_ role0_.isactive = 1 /* @p0 */ , action1_.isactive = 1 /* @p1 */

android - Shape recognition library -

there's following scenario: i have grapefruit , orange lying on flat surface. there way take picture of each object smartphone , determine rough size of objects? are there libraries recognizing 3d shapes of objects? server or client side processing both work...

multithreading - Are OS schedulers irrelevant to multithreaded algorithms? -

many algorithm cost models (see cormen's third edition, ch. 27) argue schedulers same, , constant in algorithm's order. correct? there no consequence in using o(1) scheduler vs. cfs one? thanks. many algorithm cost models (see cormen's third edition, ch. 27) argue schedulers same, , constant in algorithm's order. the simple answer yes. context in said in clrs measure performance of multi-threaded algorithms. obvious example of such measure speed-up achieved parallel/multi-threaded algorithm. job of os scheduler, in multi-processor environment, make sure processor fair share of total work if @ possible in order maximise total performance. doesn't matter scheduling algorithm followed os. because, if there's free processor , there's work done, os scheduler assign work. let's take example. x total work done(assume it's big gene computations there's enough scope parallelism), have 5 processors. wrote algorithm splits total wo

javascript - clearTimeout on dynamically updating timer -

i've got timer i'm updating dynamically. ------------------update -------------------------- when first posted question, didn't think mattered timer being called within backbone view, believe result of that, can't use global variable (or @ least global variable isn't working). i'll calling multiple timers, setting 1 global variable , deleting won't work. need able clear single timer without clearing others. what start timer, function countdown(end_time, divid){ var tdiv = document.getelementbyid(divid), to; this.rewritecounter = function(){ if (end_time >= myapp.start_time) { tdiv.innerhtml = math.round(end_time - myapp.start_time); } else { alert('times up'); } }; this.rewritecounter(); = setinterval(this.rewritecounter,1000); } in app, initiate timer in backbone view myapp.views.timer = backbone.view.extend({ el: 'div#timer', initialize: fu

android - Add a new editText on Button press -

i have simple table layout empty row <tablerow android:id="@+id/range_input1" > </tablerow> i add edittext row when user presses button. quite unsure on how though. proper way of doing it? far can think of 2 ways, first 1 have edittext in row , make row hidden, or try create edittext when button pressed. the problem have no idea how either option, nor find tutorials on explaining how add or hide forms. also wondering if possible slide effect. thanks help! add edittext tablerow , make row visibility gone : <tablerow android:id="@+id/range_input1" android:visibility="gone"> <edittext /> </tablerow> and in button on click listener: tablerow row = (tablerow) findviewbyid(r.id.range_input1); row.setvisibility(view.visible);

postgresql - Very slow Postgres UPDATE on large table -

i have postgres 9.1.3 table 2.06 million rows after where y=1 per below (it has few ten thousand more rows total without where ). trying add data empty field query this: with b ( select z, rank() on (order l, n, m, p) x y=1 ) update set a.x = b.x b a.y=1 , b.z = a.z; this query runs hours , appears progress slowly. in fact, second time tried this, had power outage after query ran ~3 hours. after restoring power, analyzed table , got this: info: analyzing "consistent.master" info: "master": scanned 30000 of 69354 pages, containing 903542 live rows , 153552 dead rows; 30000 rows in sample, 2294502 estimated total rows total query runtime: 60089 ms. is correct interpret query had barely progressed in hours? i have done vacuum full , analyze before running long query. the query within with takes 40 seconds. all fields referenced above except a.x, , extension b.x, indexed: l, m, n, p, y, z. this being run on laptop 8

css - Where is significant white space in pandoc/markdown usually regulated? -

i'm using pandoc convert markdown documents .html via custom css file. everything working except 1 thing. understand text in backticks `` should white space significant, since code inside. in case, not - in other words, looks ordinary other text. i'm interested in regulated in pandoc, or in custom css file - css attribute regulates whether white space should significant? pandoc put text between backticks inside html <code> tags. leading , trailing whitespace ignored (as in markdown.pl), internal spaces preserved. newlines treated spaces. check html source make sure have <code> tags. if don't, there problem markdown source. check make sure you're not linking css overrides default settings <code> tags.

android - onFinishInflate() never gets called -

who/what calls onfinishinflate()? no matter how inflate layout files (in code) method never seems triggered. can give me example or tell me when onfinishinflate() called? view.onfinishinflate() called after view (and children) inflated xml. specifically, during call layoutinflater.inflate(...) onfinishinflate() called. inflation performed recursively, starting root. view containing children may need know when children have finished being inflated. 1 of main uses of callback viewgroups perform special actions once children ready. let's assume had subclass of view called customview , , not internally inflate layouts itself. if had customview somewhere in layout, i.e. : ... <com.company.customview android:layout_width="wrap_content" android:layout_height="wrap_content" /> ... you should see callback onfinishinflate() once has been inflated. if in main layout of activity, can consider being after activity.setcontentview(int)

c++ - Using std::tr1::normal_distribution in Qt -

i generate numbers normal_distribution in c++11. using qt 4.8 mingw. have added next line qmake_cxxflags += -std=c++0x to .pro file , next errors: 'swprintf::' has not been declared 'vswprintf::' has not been declared tr1 should avoid when using c++11 designed meet limitations of previous standard. (also considered useful went on , became integrated standard.) luckily there comprehensive random number generation library in c++11 normal distribution. see here: http://en.cppreference.com/w/cpp/numeric/random #include <random> ::: std::random_device rd; std::normal_distribution<double> dist(0,99); std::mt19937 engine(rd()); double a=dist(engine); the exact error getting though particular implementation of tr1 isn't anyway. (missing include or missing namespace prefix).

How to find a particular URL inside a domain using PHP? -

i want find specific url inside domain not indexed on google search engine. website isn't mine , don't have privileges @ all. i have tried using sitemap generator in hope displays it: http://www.example.com?user=9191919 http://www.example.com?user=3636363 ... but allows me see 500 urls. is there php way search url without using brute force? i know stored @ path "example.com/pages" + numbers , maybe can shorten search. there aren't many practical solutions seems talking about. brute forcing simplest solution if have time. i assume wanting search page content here. <?php set_exec_limit(0); ob_start(); $url_prefix = "http://www.example.com?user="; $search = "findme"; $start = 10; $end = 1000000; for($i = $start; $i < $end; $i++){ $content = file_get_contents($url.$i); if(stripos($content,$search) !== false){ print $url.$i." \n"; ob_flush(); usleep(500); # take easy

ios5 - How can I pass a variable through a segue? -

is possible pass value of double (for example) through segue? given sample code, i'm trying pass value of uistepper (a double) through segue view. know have declare double on other controller, i'm not sure if possible. have declare in other view controller make work? thanks in advance. -pauls. -(void)prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender { if ([[segue identifier] isequaltostring:@"home2segue"]) { double classlength = stepperclasstime.value; home_1_viewcontroller *vc = (home_1_viewcontroller *)[segue destinationviewcontroller]; vc.classlength = classlength; } } that should work fine if add classlength property in home_v1_viewcontroller class: header file (.h): @property (nonatomic) double classlength; implementation file (.m): @synthesize classlength;

user defined types - Partial Objects In Oracle -

i using flat stored procedures (flat means not contained in objects) in oracle update tables. example have table person columns id, firstname, lastname, address, salary. made flat procedure person_updfirstname , procedure has 2 parameters: id, firstname. inside procedure, find row in person table matches parameter id , update firstname parameter firstname. usual stuff, nothing new. now, using oracle objects. have object persontype, udt. object has same fields columns in table person. have put of procedures related person table inside persontype object, is, instead of using flat procedures start using member procedures. none of member procedures has parameter, take values fields of object. example, in case of person_updfirstname flat procedure, have member procedure updfirstname. member procedure not take parameter, uses id , firstname fields of object itself, , update person table before. the problem is, when using flat procedures, passing parameters such id, firstname, in larg

Modern data structures -

i realized data structures regularly use old , simple. linked lists, hash tables, trees, , more complex variants such vlists or rbtrees pretty old inventions. most of them conceived serial, single cpu world , require adapting work in parallel environments. what kind of newer, better data structures have? why not used? i understand using plain old linked list if have implement , prefer simplicity, having huge stls , piles of third party libraries guava or boost , why still placing locks around hashes? don't have potentially standard, hard-proven modern data structures can replace trusty old-timers? there nothing wrong old ones. way keep flexibility separate concerns. normal (old style) datastructures concerned way how data stored. locking different concern, should not part of datastructure. locking potentially expensive operation, if can, should lock multiple structures @ once optimize code. i.e. lock critical sections not datastructures. if directly add lo

vb.net - Obraining SSRS report in the form of pdf -

i want ssrs report in form of pdf (or other portable format) automatically. mean when user presses button, instead of viewing report in report view, should converted pdf please give me vb.net code if possible. any welcomed ! thanks please try code. private sub generatereport(paramlist hashtable) rs.credentials = system.net.credentialcache.defaultcredentials rsexec.credentials = system.net.credentialcache.defaultcredentials dim historyid string = nothing dim deviceinfo string = nothing dim format string = "pdf" dim results byte() dim encoding string = string.empty dim mimetype string = string.empty dim extension string = string.empty dim warnings reportexecution.warning() = nothing dim streamids string() = nothing dim filename string = "c:\myreport.pdf" ' change want save dim _reportname string = "/sales/myreport" '