Posts

Showing posts from February, 2013

php - Server-side script for checking database in the background -

i writing "forum-like" website our class, works faq, our class can post answers. want implement system, 1 student (class president) can upload these questions (question asked teachers, , become test-questions) , select user has answer question. now want write system reminds (email) user after amount of time question hasn't been answered, , should answer it. so, need check database every ~30 minutes , see if "answertime" has run out, , send user email. i don't think can achieve php-script unless there way run script in background. thought writing external program check database, don't using program, fail without me noticing it. so wanted ask, what's best way this? you can set cron job on server side run php script every x minutes linux. for windows can set scheduled task run script every x minutes

facebook - iPhone New Facebbok SDK . post to wall not coming -

my code running in simulator(evn after implementing new facebook sdk). but when checked in device, code running, but post wall not coming. please help. i had problem , solved it, if use using method: [nsurlconnection sendsynchronousrequest:request returningresponse:&response error:&err];" in fbgraph.m file. then before calling method declare following variables nil nsurlresponse *response = nil; nserror *err =nil;

AutoIT Testing Help -

hi trying n excel file on web save automatically using autoit. the following code not working: #include <ie.au3> $oie = _iecreate ("http://127.0.0.1/my_site") _ienavigate ($oie, "http://databases.about.com/library/samples/address.xls") winwait("file download","do want open or save file?") controlclick("file download","do want open or save file","button2") winwait("save as","save &in:") trying using ie not right way. have tried using inetget function? local $sfilename = filesavedialog("save excel file...", @mydocumentsdir, "excel spreadsheet (*.xls)|all files (*.*)", 18, "address.xls") if @error exit ; user cancelled dialog local $ibytes = inetget("http://databases.about.com/library/samples/address.xls", $sfilename, 8) msgbox(0, "worked :)", "file downloaded. " & $ibytes & " downloaded.") ...

parsing - Read Arabic lettering in html into csv using Perl -

i working html has arabic lettering in it. trying parse lettering csv file opens default in excel. i using perl script parse lettering out thought using use feature 'unicode_strings'; in perl allow csv store arabic lettering not. is there way round this? use autodie qw(:all); use web::query qw(wq); use text::csv_xs qw(); $csv = text::csv_xs->new({binary => 1}) or die "cannot use csv: ".text::csv_xs->error_diag; open $fh, '>:encoding(utf-8)', 'm.csv'; $csv->print($fh, [wq( '<!doctype html> <html><head><title></title></head><body>&#x645;&#x643;&#x629; &#x623;&#x648; &#x645;&#x643;&#x629; &#x627;&#x644;&#x645;&#x643;&#x631;&#x645;&#x629; &#x647;&#x64a; &#x645;&#x62f;&#x64a;&#x646;&#x629; &#x645;&#x642;&#x62f;&#x633;&#x629; &#x644;&#x62...

python - Why does put() not work when used with indexed element in Query? -

i have issue put() not appear work if access model class indexed member of query directly; however, when explicitly extract class query seems work fine. why this? this code works: class record: field = db.stringproperty() rs = record.all().filter('name = ', name_str) if rs.count() == 1: # assume 1 record in return... r = rs[0] r.field = some_value r.put() and code doesn't (and not raise errors) class record: field = db.stringproperty() rs = record.all().filter('name = ', name_str) if rs.count() == 1: # assume 1 record in return... rs[0].field = some_value rs[0].put() every time index query this, performs query on again, fetches relevant result, decodes it, , returns you. in second snippet, modify 1 instance of entity, discard it, fetch , store (unmodified) second copy. generally, should avoid indexing queries - call .get() or .fetch() instead. for same reason, should avoid using .count() possible, since req...

c++ - Cmake multi-library scenario -

we organize c++ project this: project/ lib1/ (first library) cmakelist.txt src/ lib1.c foo1.h build/ test/ (tests) cmakelist.txt test1.c test2.c lib2/ (second library) cmakelist.txt src/ cmakelist.txt os/ (os dependent code) cmakelist.txt win32/ xxx.c (win32 implementation) linux/ xxx.c (linux implementation) lib2.c foo2.h build/ include/ (shared/public headers) lib1/ lib.h (shared library header included apps) lib2/ lib.h (shared library header -"-) please, how write cmakelists.txt when lib2 should use link1 , when e.g. lib2 should portable (at least win32, linux...)? correction : if cmakelist.txt files not on places, pl...

c# - Correct way to initialize Enums inside a class constructor -

i looking @ enums in wrong way want make sure have right theory in how use them. say have enum called colour. enum colour { red, green, blue }; red green , blue represented there 0-255 values. i'm trying initialize enum inside class shape , i'm not sure how go it. public class shape { colour colour; public shape(colour c) { //some attempts @ initialization. //treating object this.colour = c{ 255,255,255 }; //again this.colour.red = c.red this.colour.blue = c.blue this.colour.green = c.green colour.red = c.red? } } } i'm way off in terms of how i'm thinking enums. can give me pointers? in case, might want colour struct instead of enum. in c#, enums single-valued constructs, have 3 values (red, green, , blue). here's might instead: public struct colour { private byte red; private byte green...

xmlreader - jqGrid XML data property load -

i have remote xml data generator emits this: <list> <hu.qualitis.opencms.utils.db.dbfile> <id>8dc66bf4-c39f-44c5-879d-1f3b16dc29be</id> <name>testfile.txt</name> ... <metadata> <property name="lines" value="5"/> </metadata> </hu.qualitis.opencms.utils.db.dbfile> </list> my definition of xmlreader follows xmlreader: { root: "list", row: "hu\\.qualitis\\.opencms\\.utils\\.db\\.dbfile", repeatitems: false, id: "id" }, this works ok. problem metadata part cannot access. tried things like: colmodel :[ {name:'name', index:'name', width:60}, ... {name:'metadata>property>lines', index:'name', width:10} ], but no avail. is possible @ configure jqgrid xmlreader read value, or forced change generator? update to sum responses: original idea not possible implement. best solution...

visual studio - Is it possible to statically share code between projects in C#? -

is possible, in c#, share code between visual studio projects without needing distribute dll? i'm maintaining software that's composed of few visual studio c# projects, each building simple console executable. there's lot of shared code between projects i'd move out. believe can put code in class library project, i'd rather avoid tacking on dll distribute each of executables. is there way around this? i'm new @ c#, perhaps i'm thinking wrong anyway - there alternate suggestions? you can use ilmerge combine class library exe. http://research.microsoft.com/en-us/people/mbarnett/ilmerge.aspx

C++ templates weird behaviour: "not matching function" outside main -

i working templates not familiar weird happening. have templated class inherits other templated classes. the problem when create instance of class in main method works expected. however, when create same instance inside function throws compilation error: "not matching function" pointing constructor of templated class. the question why work in main method not inside function same piece of code (there no problem inclusion) the code huge ll try illustrate example int main() { mytemplatedclassparent<parameters> example(arguments); mytemplatedclasschild<parameters> example_1(arguments); } works fine. however int main() { mymethod(); } with mymethod() { mytemplatedclassparent<parameters> example(arguments); mytemplatedclasschild<parameters> example_1(arguments); } does not. in second case not recognize match between call , constructor of class , suggests candidate constructor of class want use. point same thing works in main method dif...

wpf - DataGrid - collapse all groups except the first one -

i have datagrid grouped itemssource. there expander on each group, can expand/collapse groups. now, i'm trying collapse groups default, leave first group expanded. items source dynamic, can't build converter check group name. must group index. is possible in in xaml? or in code-behind? please, help. this might little late, in order similar problems, defining "visual tree helper class" helpful in case. // visual tree helper class public static class visualtreehelper { public static collection<t> getvisualchildren<t>(dependencyobject current) t : dependencyobject { if (current == null) return null; var children = new collection<t>(); getvisualchildren(current, children); return children; } private static void getvisualchildren<t>(dependencyobject current, collection<t> children) t : dependencyobject { if (current != null) { if...

wireshark - Sniff POST variables through HTTPS -

i trying reverse engineer script can submit form using mechanize. form using weird javascript form upload script can't seem understand. thinking sniff traffic going browser server. first of all, possible? if so, way it? have tried wireshark filter 'http.request.method == "post"', doesn't seem work. i use http live headers plugin firefox . sample capture http live headers post /login http/1.1 host: signup.netflix.com user-agent: mozilla/5.0 (windows; u; windows nt 5.1; en-us; rv:1.9.2.16) gecko/20110319 firefox/3.6.16 accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 accept-language: en-us,en;q=0.5 accept-encoding: gzip,deflate accept-charset: iso-8859-1,utf-8;q=0.7,*;q=0.7 keep-alive: 115 connection: keep-alive referer: https://signup.netflix.com/login?country=1&rdirfdc=true --->insert lots of private stuff here content-type: application/x-www-form-urlencoded content-length: 168 authurl=somelongtextstring&next...

timing - How to calculate the execution time in C? -

how can calculate execution time in following code: #include <stdio.h> /* core input/output operations */ #include <stdlib.h> /* conversions, random numbers, memory allocation, etc. */ #include <math.h> /* common mathematical functions */ #include <time.h> /* converting between various date/time formats */ #include <sys/time.h> #define pi 3.1415926535 /* known vaue of pi */ #define ndarts 128 /* number of darts thrown */ double pseudo_random(double a, double b) { double r; /* random number */ r = ((b - a) * ((double) rand()/(double) rand_max)) + a; return r; } int main (int argc, char *argv[]) { int n_procs, /* number of processors */ llimit, /* lower limit random numbers */ ulimit, /* upper limit random numbers */ n_circle, /* number of darts hit circle */ i; /* du...

c++ - should I use member variable or declare variable inside functions? -

i have class ui handle console i/o c++ program. have 4-5 member functions use variable 'string input' cin input, , of these functions recursive. wondering if should declare 'string input' @ beginning of each of these functions, or if better have private member variable , input.clear() @ beginning of each function. what's best choice, style p-o-v , efficiency p-o-v? if string input not persistently associated object in long term, , being used locally in short term, make local variable. 1) it's semantically mean anyway. 2) if you're calling recursively, want separate variables per recursive call, local variables give automatically. 3) efficiency standpoint, a) difference small notice anyway, , b) it's faster create new variable on stack keep pointing @ object's member variable, unless construction of expensive.

nlp - Best model for topic spotting/discovery -

what best model topic spotting within short unstructured documents, ex. sms or twitter messages? latent dirichlet allocation? lda 1 of strongest models available topic modeling, applying short texts such twitter/microblog posts might require work. authors of this paper discuss lda , alternative model , recommend aggregating multiple posts before running topic model on it. [watch out terminology: "topic spotting" old synonym supervised document classification.]

jquery - json returning list<customers> -

i'm returning list<customer> json result in controller. in client script can see customers fine being returned. can somehow use forin loop? because when try says var undefined. for (var in customers) { alert(i.customername); } try: for (var in customers) { alert(customers[i].customername); }

javascript - Binding values to variables mentioned in a script -

i'm creating gwt version of java library has support javax.script.scriptengine evaluate functions dynamically via javascript, e.g., o => o % 2 == 0 where @ runtime, value of "o" defined via javax.script.bindings (the o => part stripped of course). the problem is, how can same effect within gwt? use native function native object nativeeval(string script) /*-{ return $wnd.eval(script); }-*/ nativeeval("o % 2 == 0"); but how can bind value identifier "o"? new function("o", "return (" + expressionthatuseso + ")")(o) if expressionthatuseso "o % 2" equivalent global function called (function (o) { return o % 2; })(o) for reference, https://developer.mozilla.org/en/javascript/reference/global_objects/function : new function ([arg1[, arg2[, ... argn]],] functionbody) parameters arg1, arg2, ... argn names used function formal argument names. each must string...

android - Can I use the same keystore file to sign two different applications? -

i have upload new application, it's design that's little different. yesterday generated keystore file sign application. can use same? you can use keystore number of applications. no need generate new keystore.

How to add Items in Winforms comboBox into WPF? -

i want add winforms combobox wpf application. added using windowsformshost, couldn't add items combobox. here xaml code : xmlns:wf="clr-namespace:system.windows.forms;assembly=system.windows.forms" <windowsformshost name="mywfh"> <wf:combobox name="mycmb" selectedindexchanged="combobox_selectedindexchanged" > </wf:combobox> </windowsformshost> public window2() { initializecomponent(); combobox cb = (combobox)mywfh.child; // gives error cannot cast cb.items.add("one"); cb.items.add("two"); } in xaml, can't find way add items. in code behind can't access mycmb, can access mywfh not mycmb. how add items combobox? i think trying cast wpf combobox(system.windows.controls.combobox). should cast system.windows.forms.combobox, , can add items or whatever want. btw, why using forms combobox when have...

arrays - Ruby: Remove whitespace chars at the beginning of a string -

this question has answer here: ruby function remove white spaces? 20 answers i have array of words trying remove whitespace may exist @ beginning of word instead of @ end. rstrip! takes care of end of string. example_array = ['peanut', ' butter', 'sammiches'] desired_output = ['peanut', 'butter', 'sammiches'] as can see, not elements in array have whitespace problem, can't delete first character if elements started single whitespace char. full code: words = params[:word].gsub("\n", ",").delete("\r").split(",") words.delete_if {|x| x == ""} words.each |e| e.lstrip! end sample text user may enter on form: corn on cob, fibonacci, stackoverflow chat, meta, badges tags,, unanswered ask question string#lstrip (or string#lstrip! ) what you're aft...

computer vision - Help in using OpenCV - Errors of type: identifier not found -

am beginner opencv , have gone far work out hello world samples, inverting, color conversion(rgb->greyscale ) etc programs working. stuck @ programs use cvcanny, cvpyr , other such feature detectors.would thankful if tiny prblem sorted out . i error: error c3861: 'cvpyrdown': identifier not found error c3861: 'cvcanny': identifier not found i've included imgproc , features2d headers yet problem persists. missing out ? do have "additional input directories" property set correctly? mine, configured cmake, looks this: c:/opencv-2.2.0/release c:/opencv-2.2.0/include c:/opencv-2.2.0/include/opencv c:/opencv-2.2.0/modules/core/include c:/opencv-2.2.0/modules/imgproc/include c:/opencv-2.2.0/modules/features2d/include c:/opencv-2.2.0/modules/gpu/include c:/opencv-2.2.0/modules/calib3d/include c:/opencv-2.2.0/modules/objdetect/include c:/opencv-2.2.0/modules/video/include c:/opencv-2.2.0/modules/highgui/include c:/openc...

jsf 2 - How do I add ajax behavior to a dynamically created component in a backing bean? -

in respose infragile's request in thread, asking separate question rather followup. here problem attempting address: i'm migrating jsf1.2 jsf2. worked fine in jsf1.2. have rewritten critical item composite component panel created in backing bean adding components in code. in particular, have h:inputtext , h:selectonemenu components create in code along "apply" h:commandbutton. "apply" button has action listener checks values in h:inputtext , h:selectonemenu components. works fine, when fetch values in h:inputtext or h:selectonemenu components original values, not new values entered user. said, worked fine in jsf1.2 (i got new values), not in jsf2 reason. i have tried several things around haven't worked, figured add ajax behavior h:inputtext , h:selectonemenu items , when values in these components change, call backing bean listener ajax behavior fetch new values. i trying add ajax behavior component create in code (not bound page componen...

iis - WCF services on Azure -

i planning migrate vps functions azure subscription. have free 3 year bizspark subscription gives me 20 cores, 6 hosted services , 5 storages. believe 2 small instances. my main aim transfer 10 or wcf applications run on iis7.0 server. how many wcf services able host azure? ive been reading , playing azure day, still confused does. current playing, seems each wcf service needs own hosted service, ahve 6 of? or getting confused. wcf services need put in 'hosted service'? thanks. let me see if can out bit: windows azure platform can deploy applications cloud , not worry building plumbing underlying infrastructure or features such caching, identity management, etc. each windows azure subscription has multiple deployment slots, or hosted services. limited 6, meaning can deploy 6 complete deployment packages (with each deployment package consisting of 1 or more virtual machine instances). each virtual machine, called role, takes number of cores. small role ...

Jquery Accordion not displaying properly in Chrome -

i using jquery script http://www.marghoobsuleman.com/jquery-common-accordion , have implemented site. it works fine in firefox , ie chrome doesn't display correctly. the entire content div flickers during transition , afterwards content div comes underneath title divs. i have narrowed down piece of jquery code not working correctly: function openme(id) { var stitleid = id; var icurrent = stitleid.split("_")[stitleid.split("_").length-1]; options.currentcounter = icurrent; var scontentid = id+"_mscontent_"+icurrent; if($("#"+scontentid).css("display")=="none") { if(options.previousdiv!="") { closeme(options.previousdiv); }; if(options.vertical) { $("#"+scontentid).slidedown("medium"); } else { $("#"+scontentid).show(400); //...

Visual stuidio publish query -

q1. how can (if can) publish website project source code? whenever publish website, converts .cs files dlls in bin folder. want pe published cs files , refered external dlls q2. when publish web application project, gives publish/package settings options not available website projects. setting tab give options copy source code creates many other unwanted files config.debug, config.release etc. how can make publish application files in project , nothing new. use "copy site" instead of "publish site" (right click on web project or click "web site" menu).

Creating columns dynamically with Datatables Jquery -

i using datatables server_processing data, main issue dont want specify name of columns in html (<th width="25" id ="th1">id</th>) , want create columns dynamically when getting data ajax. my code : $('#table').datatable( { "bprocessing": true, "bserverside": true, "sajaxsource": "server_processing.php?db="+pid+"&table="+id+"", //pid name of database , id name of table "bjqueryui": true, "spaginationtype": "full_numbers" } ); "although datatables can obtain information table directly dom, may wish give datatables specific instructions each individual column. can done using either aocolumndefs parameter, or aocolumns , object information given each column." — http://datatables.net/usage/columns something like: html <table class="display" id="table"></table...

javascript - Does IE need an element to be inserted into the DOM before knowing it's properties? -

hope not duplicate question, quick search didn't give me results. need create <select multiple="multiple"> element dynamically, using data this: var _options = [ { materialcombined: '123 - asd', materialname: '123' },{ materialcombined: '143123 - asdqw', materialname: '143123' } ]; now, following code works in browsers != ie var select = new element('select ', {'multiple ': 'multiple ','size ': ((_options.length > 5) ? 5 : _options.length),'class ': 'af_ddl ','style ': 'width: 250px'}); (var = 0; < _options.length; ++i) { var option = new element('option ').update(_options[i].materialcombined); option.value = _options[i].materialname; select.options.add(option); } but in ie, throws exception when trying call add() on select.options property. why that? ie need select inserted dom befo...

java - How to launch the graph as initial activity using achartengine -

in app want display graph when app launches. used tab activity. possible implement without tab activity? if yes, how implement this. please can me. code: public class alinegraph extends tabactivity { tabhost tab_host; tabspec tab1; /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); tab_host = gettabhost(); tab1 = tab_host.newtabspec("1wk"); tab1.setindicator("1wk"); linegraphpage actc = new linegraphpage(); intent intent = actc.execute(alinegraph.this); tab1.setcontent(intent); tab_host.addtab(tab1); } }

sql - Searching a table to find a certain ID: error 80040e10 no value for one or more parameters -

in access 2007, searching table find id. id address given in text box user idtxt. error 80040e10 no value 1 or more parameters. private sub search_click() 'here new part i'm not sure about... dim cn adodb.connection dim rsq adodb.recordset set cn = currentproject.connection set rsq = new adodb.recordset dim strsql string dim id_number integer dim blnexists boolean blnexists = false id_number = idtxt.value strsql = "select * table1 id = id_number;" rsq.open strsql, cn, adopenstatic if rsq.recordcount <> 0 ' found blnexists = true msgbox "found" else msgbox "not found" end if end sub your passing string without substituting value; strsql = "select * table1 id = id_number;" needs strsql = "select * table1 id = " & id_number as id_number in context of vba variable outside string. (your not performing type checking on id_number text in unrestricted textbox error, ...

sql - First creation of file in objective c project -

i'm developing 1 of first app in iphone , have little doubt: should verify existence of database , plist files in document folder? i use these data in different view controller, don't think viewdidload of each 1 solution. i think applicationdidfinishlaunching, in way make slow starup copying sql database bundle documents , writing plist of 10 nodes? any seggestion welcome, thank read this. giuseppe. i think applicationdidfinishlaunching place it. need copy first time user runs app, right? if you're worried slow initial start, , view needs these files copied first view load won't defer copying until view loads since @ app startup anyway. if, however, don't need data , find copy slow, might consider doing copy spawning thread copy applicationdidfinishlaunching.

asp.net: how to use ssl certificate -

i created ssl certificate using iis 5.1 , generated file certreq.txt. next step use file. developer , working on site host on local machine. is necessary license ca? please guide me asap. you can create s elf-signed cert , not elegant end users if public website there prompt cert validity. otherwise, yes need obtain cert ca. find best verisign , although not cheapest. others godaddy, cheapdomain, , pretty registrar can it. the link 5.1, can find tutorials on versions. testing go self signed route.

php - Converting coordinates into map addresses -

i developing gps server , tracking system: how can convert latitudes , longitudes data got gps tracking device address data client application report displaying road names instead of coordinates? how can map coordinate data tracker position displayed on map i.e. google maps or vector maps? i'll highly appreciate answers or suggestions use reverse geocoder. http://code.google.com/apis/maps/documentation/geocoding/#reversegeocoding use mapping api google maps. http://code.google.com/apis/maps/documentation/javascript/

c# - Mock Device connecting through USB -

i have device , drivers device. build application mocks usb device communicate third party application. more specifically, attempting build application can mock usb device mimics microsoft zune. want make application can register zune device , communicate client. have added several dll's application in order attempt determine calls tell software connected device legitimate zune, far haven't had luck. i'm new type of development - mimicking hardware devices, , i'm not experienced in importing dll's written in c/c++. using visual studio 2010 (.net 4.0) develop app, , appreciate can offer me towards mimicking hardware. have device drivers, visual studio refuses reference directly. have actual physical device, can see drivers uses in device manager. the goal follows application registers usb device, mimicking microsoft zune in similar fashion how virtual clone drive mimics dvd player. application recognized zune client valid microsoft zune. zune sof...

types - Haskell - fmap fmap doesn't work -

i'm using ghci (version 6.12.3) play bit haskell. read functors , applicative functors thought if couldn't similar <*> of applicative functors implemented using functor's primitives. after thinking came fmap fmap have (nearly) ideal type of functor f => f (a -> b) -> f (f -> f b) or more generically (functor f1, functor f2) => f1 (a -> b) -> f1 (f2 -> f2 b) i tried let q = fmap fmap i got following error <interactive>:1:8: ambiguous type variable `f1' in constraint: `functor f1' arising use of `fmap' @ <interactive>:1:8-16 probable fix: add type signature fixes these type variable(s) <interactive>:1:13: ambiguous type variable `f' in constraint: `functor f' arising use of `fmap' @ <interactive>:1:13-16 probable fix: add type signature fixes these type variable(s) writing above type signature suggested didn't help. craziest thing when typed :t f...

php - How to Unlike a Comment using Javascript in facebook Graph API -

how unlike comment liked using graph api? according graph api docs can send delete request /comment_id/likes , that'll clear like.

ado.net - Is there an Entity Framework data provider for the Azure Blob Service? -

i'm considering using wcf data services implement service exposing objects stored in azure blob service. wonder if use data model based on entity framework. understand, need data provider compatible entity framework store , retrieve data blob service. there such data provider? there isn't data provider azure storage compatible entity framework. creating such data provider not worthwhile because it's complex project , because entity framework not match azure storage's conceptual model. entity framework designed relational databases , azure storage rest-based non-relational storage. as creating wcf data services layer on azure storage, built using wcf data services toolkit . references: is possible use entity framework windows azure development storage service? entity framework azure storage table access azure table storage via wcf data services (csazuretablestoragewcfds)

Permission errors in PowerShell -

i new powershell. when trying write simple script deletes contents of folder , fills files copied different folder, permissiondenied error. details: + remove-item <<<< d:\path\* -recurse + categoryinfo : permissiondenied: (save.gif:fileinfo) [remove-item], ioexception + fullyqualifiederrorid : removefilesystemitemunauthorizedaccess,microsoft.powershell.commands.removeitemcommand where problem? able manipulate both folders through explorer. error occurs both when running script file , shell (using windows powershell ise). ise process runs under account. i'm running windows 7 professional , local administrator. edit: after richard's suggestion, tried verbose mode (which seemed have no effect). ps z:\> $error[0] | fl * -force psmessagedetails : exception : system.io.ioexception: not enough permission perform operation. targetobject : d:\path\file.txt categoryinfo : permissiondenied: (d:\path\file.txt:f...

How to use jQuery UI dialog with ASP.NET UpdatePanel? -

this have tried: in webform: <div class="demo" style="float: left"> <div id="dialog" title="basic dialog"> <p>this animated dialog useful displaying information. dialog window can moved, resized , closed 'x' icon.</p> </div> <button id="opener">open dialog</button> </div> <!-- end demo --> in masterpage: <script type="text/javascript"> // increase default animation speed exaggerate effect $.fx.speeds._default = 1000; $(function () { $("#dialog").dialog({ autoopen: false, show: "blind", hide: "explode" }); $("#opener").click(function () { $("#dialog").dialog("open"); return false; }); }); </script> as can see, trying implement demo jquery ui official websi...

c# - When Would You Implement Your Own Sorting Algorithm? -

forgive me if silly question....but think comp. sci. classes , distinctly remember learning/being quizzed on several sorting algorithms , corresponding 'big o' notation. outside of classroom though, i've never written code sort. when results database, use 'order by'. otherwise, use collection class implements sort. have implemented icomparable allow sorting; i've never gone beyond that. was sorting academic pursuit of don't implement languages/frameworks? or modern languages running on modern hardware make trivial detail worry about? finally, when call .sort on list(of string), example, sort algorithm being used under hood? while might need implement sorting algorithm understanding different algorithms , complexity might in solving more complex problems. finally, when call .sort on list(of string), example, sort algorithm being used under hood? quick sort

Is there a built in way to make custom events in JavaScript natively? -

i playing around javascript little while ago, , irritated me couldn't create own event. i've seen framework's built in (jquery, mootools, prototype. dojo doesn't weird because seems , laundry) , built own system creating , firing custom events. it feels there should native way it. know how this/if can? var dragevent = document.createevent("event"); dragevent.initevent("dragged", true, true); el.dispatchevent(dragevent); for official specs, see dom level 2 events . see createevent() , initevent() / initmouseevent() / inituievent() , , dispatchevent() @ mdc. i use technique create custom drag , resize events communication on this sample page .

algorithm - K nearest neighbour vs User based nearest neighbour -

i reading on recommender systems on wikipedia , section on "algorithms" seems suggest k nearest neighbour , collaborative filtering based user based algorithm 2 different things. correct? given understanding, aren't both same? if not, differences between them? thanks. not exactly. similar (they share same ideas), there several major differences between them. in fact, article on wikipedia describes 2 distinct ways implement recommender systems, there more of them use idea both these ways. so here's how understood wikipedia article. 1st approach (knn/profiles similarity) first of all, knn not main feature of first approach. it's algorithm find nearest items among whole collection, can used in collaborative filtering well. important idea lies in term "similarity". recommend user in question, find people neighborhood have similar profile. example, want make recommendation user john on facebook. @ fb profile , @ profiles of friends. find ...

C, C++: Shared libraries: Are single functions or complete libraries loaded into memory? -

with static compilation, functions of library needed program linked program. how shared libraries ? functions needed program loaded memory dynamic linker, or total shared library loaded ? if functions, how actual size of program including loaded functions during runtime ? thank ! oliver with static compilation, functions of library needed program linked program. how shared libraries ? shared libraries referenced program symbolically, is, program identify, name, shared library linked with. are functions needed program loaded memory dynamic linker, or total shared library loaded ? the program reference specific entry points , data objects in shared library. shared library mapped memory single large object, pages referenced paged in kernel. total amount of library gets loaded depend on both density of references, references other images linked it, , locality of library's own functionality. if functions, how actual size of program including loaded functions duri...

osx - how do you use the terminal on mac os 10 to write and compile c++ code? -

how use terminal on mac os 10 write , compile c++ code? have power mac power pc chip/with leopard. first, make sure you've got apple's developer tools installed. may on mac os x install disk well, if don't feel downloading. (although may older version) after that, cd code , similar this: g++ -o my_executable my_cpp_code.cpp you can run this: ./my_executable

javascript - Character representation from hexadecimal -

is possible convert hexadecimal value respective ascii character, not using string.fromcharcode method, in javascript? for example: javascript: 0x61 // 97 string.fromcharcode(0x61) // c-like: (char)0x61 // not in fashion, because javascript loosely typed, , not allow 1 define variable's data type. what can do, though, creating shortcut: var char = string.fromcharcode; // copy function variable then can call char instead of string.fromcharcode : char(0x61); // which quite close want (and perhaps more readable/requiring less typing).

mysql - how to know the sql join size taken by the query? -

knowing join size or combinationns taken query can me optimize query whatever query using add explain @ beginning, example: explain select * sometable id < 1000 and estimated number of rows mysql need check.

swing - TweetDeck like UI in Java -

can guide me how can create gui tweetdeck in java(desktop programming). using java swing packages, simple looks. how can make more eye catchy? :) the ui , feel (l&f) in tweetdeck can applied in java desktop program using nimrod l&f. can try @ http://personales.ya.com/nimrod/screenshots-en.html . grayish theme, can save .theme file below: nimrodlf.p1=#a1a0a0 nimrodlf.p2=#abaaaa nimrodlf.p3=#b5b4b4 nimrodlf.s1=#464746 nimrodlf.s2=#666666 nimrodlf.s3=#5a5b5a nimrodlf.w=#717171 nimrodlf.b=#ffffff nimrodlf.menuopacity=140 nimrodlf.frameopacity=0

iphone - UITableView ticks cells randomly when they leave the frame -

Image
i have uitableview in can tick 4 cells. if tick amount of cells , scroll or down, tick random cells. don't understand logic behind because method use ticking didselectrowatindex doesn't executed (i put breakpoint in there check it). not know causing here cellforrowatindex: - (uitableviewcell *) tableview: (uitableview *) tableview cellforrowatindexpath: (nsindexpath *) indexpath { static nsstring *cellname = @"prefstableviewcell"; uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier: cellname]; if (cell == nil) { cell = [[[uitableviewcell alloc]initwithstyle:uitableviewcellstylesubtitle reuseidentifier:cellname] autorelease]; } nsuinteger row = [indexpath row]; drink *drink = [drinks objectatindex:row]; cell.textlabel.text = drink.name; cell.detailtextlabel.text = [nsstring stringwithformat:@"%d", drink....

cocoa touch - API Key and RESTKit -

i'm using restkit service created me. model in json user is: { "api_key" : "123456" "user" : { "username" : "user1", "email" : "me@email.com", "name" : "name1", "surname" : "surname1" } } i need introduce api_key if want user /users/1.json . read in documentation set app-wide api key http header. the example is: [client setvalue:@"123456" forhttpheaderfield:@"x-restkit-api-key"]; is right way this? how can discover @"x-restkit-api-key" of service? (not api_key value, search string replace @"x-restkit-api-key" service) hmm, sample request, suggest use rkclient object. give example: #import <restkit/restkit.h> #import "jsonkit.h" rkclient* client = [rkclient clientwithbaseurl:@"http://yourdomainwhereisapi.com"]; and anywhere in...

how do I do groups for unix commands -

i want this: python *.py > *.std i tried doing: python (*).py > \1.std but wrong, you don't. process them in loop. for f in *.py python "$f" > "${f%.py}".std done

java - A question about Thread and Process -

i read tutorial threads , processes, said processes scheduled operating system kernel, , threads can managed , scheduled in user mode. i not understand saying "threads can managed , scheduled in user mode", example: producer , consumer problem? example "scheduled in user mode"? or can explain me? not sure tutorial you're looking at, there 2 ways threads can scheduled. the first user-mode scheduling, mean 1 process, using green threads or perhaps fibers , schedules different threads run without involving operating system in decision. can more portable across operating systems, doesn't allow take advantage of multiple processors. the second kernel scheduling, means various threads visible kernel , scheduled it, possibly simultaneously on different processors. can make thread creation , scheduling more expensive, however. so doesn't depend on problem trying solve. user-mode means scheduling of threads happens without involving oper...

css - Problem Getting '<blockquote>' IMGs to Show -

on this page can see quote in pink box. it's supposed have quote mark images right , left of it. this css: blockquote { padding-left: 10px; color:#444; font-style: normal; background: #ff9999 url(quoleft.png) left top no-repeat; } blockquote div { padding: 0 48px; background: #ff9999 url(gu.png) right bottom no-repeat; } would able tell me why images left , right of quote not showing? thanks in advance! tara p.s.:i haven't designed quote mark images yet i'm using alternative images , should show in place. problem #1 problem #2 problem #3 - using blockquote div instead of blockquote p

r - Is there a way to define all Sweave options in code? -

quoting pgfsweave manual: how set subdirectories gures , caches? straight out of sweave , cachesweave manuals (nothing new here). figures subdirectory use prefix.string option: \sweaveopts{prefix.string=figs/fig} for caching subdirectory use code chunk @ beginning or document like: <<setup,echo=f>>= setcachedir("cache") @ i find annoying 2 options in different places, r code vs. latex directive. there way set prefix.string option r code, perhaps before sweave called? sweave options can set globally either using \sweaveopts or in call sweave , this: sweave("tmp.rnw", prefix.string="figs/figs")

Jquery zoom image with image map -

i implement image map along zoom using jquery . there way ? .. couldn't find tutorial/example have them both. appreciate help! have @ these examples . can download them try reverse engineer way need. perhaps once started on something, people here can give more advice complete it

android - Keeping footer nav fixed to bottom of mobile viewport while scrolling content -

i have fixed set of navigation buttons the foot of mobile device viewport , keep these fixed here when user scrolls content. @ moment when user scrolls down buttons scroll page? have tested in android , iphone 4 , getting same outcome. testing on desktop browser in chrome + ff etc works fine there different need achieve on mobile? test page here: www.kylehouston.com/testing/mobile/ all advice welcome kyle ios 4 doesn't have position: fixed think ios 5 mobile safari does. fixed positioning in mobile safari

xaml - How can I specify letter spacing or kerning, in a WPF TextBox? -

Image
i'd modify spacing between characters in wpf textbox. letter-spacing: 5px thing available in css. think possible in xaml; what's simplest way? i found " introduction glyphrun object , glyphs element " document, , found exceedingly unhelpful. this code example page: <!-- "hello world!" explicit character widths proportional font --> <glyphs fonturi = "c:\windows\fonts\arial.ttf" fontrenderingemsize = "36" unicodestring = "hello world!" indices = ",80;,80;,80;,80;,80;,80;,80;,80;,80;,80;,80" fill = "maroon" originx = "50" originy = "225" /> the same documentation page gives "explanation" indices property does: i have no idea of means. i'm not sure indices right thing - comment in code speaks of "character widths" don't care about. want adjust ...

jquery - Typing in the value of an input doesn't change the .val() of the input? -

Image
screenshot 1: unchanged: screenshot 2: changed, yet .val() shows original : .val() returns same thing, because in html, text inbetween <textarea> tags remains same. <textarea id="suggested_text" name="suggested_text" style="width: 100%; height: 250px;">enter comment(s) click submit.</textarea> how behave normally? can retrieve value of typed in box? you should use $("#suggested_text").html() instead! you may see live: http://jsfiddle.net/z6rmb/ edit: realized on link above used .val(), worked fine me , html first proposed not!!!

javascript - sencha touch change colour of a specific list item -

have basic list component, want change row colour of rows depending on value/ have tried setting tpl doesnt seem work. appreciated ext.create('ext.dataview.list', { id : 'mylist', store: mystore, tpl: new ext.xtemplate( '<tpl for=".">' ' <tpl if="val == 0"><div style="background-color:red">{name}</div></tpl>', ' <tpl if="val == 1"><div>{name}</div></tpl>', '</tpl>' ) }); ah, basic mistake, you've got in code :: <tpl if="val == 0"> and should instead ::: <tpl if="val === 0"> ** notice 3 "equal to" signs need add between 2 values you're comparing. if wrote x=y then in template x==y // (you add equal) so conditional statement x==y //when you're checking if values equal becomes ...

java - How to write a While Loop for Simple Increments? -

i need write while loop following: "hello" part of output 8 9 11 14 hello 18 while(counter < 18 ) { system.out.print(" " + counter); counter = counter + 1 ; if(counter > 14 && counter < 18){ system.out.print(" hello "); } } the above sample code. unable figure out how increase 1, 2 3. can , please? you need additional variable stores amount increment. variable has incremented 1 in each run of loop.

python - Django 1.3 post login/logout signals in relation with authentication -

first of both methods below return true. i'd expect second 1 return false using django standard admin authentication procedure or wrong? def post_login(sender, **kwargs): """ django 1.3 post login signal handler """ # stuff user = kwargs['user'] print user.is_authenticated() user_logged_in.connect(post_login) def post_logout(sender, **kwargs): """ django 1.3 post logout signal handler """ # stuff user = kwargs['user'] print user.is_authenticated() user_logged_out.connect(post_logout) anyway i'm trying understand why django doesn't have hook on authentication failure also.. can use own backend users login , out of account, hook onto admin procedure cover in 1 portion of code.. found topics no real awnser how fix this. i came with: import settings django.dispatch import signal failed_login = signal(providing_args=['user']) djan...

regex - Remove urls using PHP -

i'd remove anchor tags , actual urls. instance, <a href="http://www.example.com">test www.example.com</a> become test . thanks. to complement gd1's answer, urls: // http(s):// $txt = preg_replace('|https?://www\.[a-z\.0-9]+|i', '', $txt); // www. $txt = preg_replace('|www\.[a-z\.0-9]+|i', '', $txt);

windows - Could a shell extension be causing my program to crash? -

my company builds mfc application runs on windows xp. 1 of our customers has reported crash in application occurs when opens common file dialog allow user save log file. we haven't observed crash on of our integration systems. customer provided crash dump shows program trying read inaccessible memory @ address 160b2d48. address appears code section of address space, there dlls loaded above , below (15dc0000-16085000 , 160c0000-1611b000), nothing loaded @ address. stack of crashing thread follows: > shell32.dll!cfsfolder::getdetailsex() + 0x533c8 bytes shell32.dll!cinfotip::_getinfotipfromitem() + 0x169 bytes shell32.dll!cinfotip::getinfotip() + 0x1c bytes shell32.dll!cfolderinfotip::getinfotip() + 0x95 bytes shell32.dll!cstatusbarandinfotiptask::runinitrt() + 0xf5 bytes shell32.dll!crunnabletask::run() + 0x4c bytes browseui.dll!cshelltaskscheduler_threadproc() + 0x82 bytes shlwapi.dll!executeworkitem() + 0x1d bytes ...

c# - Is it possible to create a generic Repository class for all my objects? -

i have following poco class repository pattern implementation. if model big enough make sense make generic 1 implementation needs done. is possible? can please show me how? public class position { [databasegenerated(system.componentmodel.dataannotations.databasegeneratedoption.identity)] public int positionid { get; set; } [stringlength(20, minimumlength=3)] public string name { get; set; } public int yearsexperiencerequired { get; set; } public virtual icollection<applicantposition> applicantposition { get; set; } } public interface ipositionrepository { void createnewposition(position contacttocreate); void deleteposition(int id); position getpositionbyid(int id); ienumerable<position> getallpositions(); int savechanges(); ienumerable<position> getpositionbycustomexpression(expression<func<position, bool>> predicate); } public c...