Posts

Showing posts from June, 2011

How to create an array of custom type in C#? -

i created object array different types of elements in them: public static int a; public static string b; public static ushort c; object[] myobj = new obj[]{ a, b, c}; if want create array contains elements of arrays of myobj type, how it? i mean this: myobj[] myarray = new myobj[]; <= this, myobj should type. not sure how work out. thanks everyone. how use dictionary store types need? so, while not have mytype.a , can have mytype.values["a"] , close enough, makes use of standard c# constructs, , gives lots of flexibility/maintainability public class mytype { public mytype() { this.values = new dictionary<object, object>(); } public dictionary<object, object> values { get; set; } } and sample usage: using system; using system.collections.generic; public static class program { [stathread] private static void main() { var mytypes = new mytype[3]; myt...

svn - Access forbidden when attempting to create a branch from the trunk TortoiseSVN -

so attempting create branch of project in order keep modifications making effecting trunk/src. however, whenever tried create branch message: error: access '/svn/installer/!svn/act/86a58bed-75e1-be46-8f82-d479f2ba037c' forbidden what error message mean , circumstances tend causes error message occur? also can fix error , create branch successfully? any or advice deal problem appreciated! thank in advance. clearly it's related access rights first thing check you're sure username, password , branch path correct including case . if don't have luck this, try creating new folder in branch path directly tortoisesvn repo browser. should establish whether identity has rights write path. one of above should answer question.

templates - Techniques for using native php as a smoothly inline-able templating engine -

goal: best system refactoring complex & ugly code in same file. i'm in process of refactoring else's bad code. code intermixed, procedural php , want able create templates -in- script. don't want have create external file of different type run template, want able take horrible stuff happening in script , make template in script, , call template right horrible stuff once was. , still able see template outputting in same file. i rediscovered php's alternative syntax simplify native templating ( http://php.net/manual/en/control-structures.alternative-syntax.php ). example system are there other techniques simplifying templating process native php templates? prefer template engine because makes php echoing simpler using php syntax, when refactoring other people's code, templating engine lot of overhead , imposes lot of rules, such having templates in "templates" folder seperate script you're refactoring, makes difficult placement when ...

data binding - Image not showing in grid -

in app want display picture inside listbox, linked objects through databinding. however, picture isn't showing reason, , can't seem spot error. know picture in object, because if add new image object xaml, , in code set source 1 of images object, shows it. below code in steps: foreach (indtastning indt in listboxindhold.itemssource) { byte[] data = convert.frombase64string(indt.imagename); stream memstream = new memorystream(data); writeablebitmap wbimg = picturedecoder.decodejpeg(memstream); indt.picture = new image(); indt.picture.source = wbimg; //below test image, shows picture correctly. testimage.source = indt.picture.source; } my xaml image: <listbox x:name="listboxindhold" grid.row="0" itemssource="{binding .}" scrollviewer.verticalscrollbarvisibility="visible" ...

.NET: Email Address Parsing - save with RegExp or just Try/Catch around Mail.MailAddressParser? -

what recommend simple result "ismailvalid?" -> true|false? is save use regexp is better use .net's system...mail.mailaddressparser simple try/catch around it? since speed not relevant, think going way mailaddressparser ok? regards john given requirements speed not being necessary, use mail.mailaddressparser try/catch. it's guaranteed filter out .net runtime can't recognize valid email address, , simpler. a regex same, bad regex give false positives, false negatives, or both. the performance cost in handling exceptions make me go other way if speed factor, in case, requirements, less code, more readable code, , "just works" balance out performance factor. clarification: i'm assuming intended code this: try { system.net.mail.mailaddress address = new system.net.mail.mailaddress(somestring); } catch(exception ex) { // handle invalid email addresses here. } and recommendation situation. intentional except...

gzip - Jsoup and gzipped html content (Android) -

i've been trying day make thing works it's still not right yet. i've checked many posts around here , tested many different implementations i'dont know now... here situation, have small php test file (gz.php) on server wich looks : header("content-encoding: gzip"); print("\x1f\x8b\x08\x00\x00\x00\x00\x00"); $contents = gzcompress("is working?", 9); print($contents); this simplest , works fine web browser. now have android activity using jsoup has code : url url = new url("http://myserveradress.com/gz.php"); doc = jsoup.parse(url, 1000); which cause empty eofexception on "jsoup.parse" line. i've read everywhere jsoup supposed parse gzipped content without having special, obviously, there's missing. i've tried many other ways using jsoup.connect().get() or inpustream, gzipinputstream , datainpustream. did try gzdeflate() , gzencode() methods php no luck either. tried not declare header-encod...

c# - what datatype to use to store "MMYYYY" format -

i using .net environment , wanted track expiration date found in credit cards. date there of nature "mmyyyy". recommended way store ? should use .net string or instead use .net datetime object ? in cases easiest solution best solution. easy maintain, easy other programmers recognize, , may keep out of trouble (ints , strings can lead localization problems , invalid values). a system.datetime best option , gives flexibility cards may expire on given day (they rare, exist, , may become more prevalent temporary credit cards becoming popular). when storing value use date property of system.datetime struct since disregard time components.

c# - How to connect to a MySQL database inside the .NET framework? -

i'm opening discussion here on subject couldn't find answer enough called final answer: mysql , .net. while know there lot of ways make connection, i'm trying find list of pros , cons of each approach. i've been using ado.net mysql netconnector since beggining of project, , ok when database new , didn't have many records. i'm facing situation number of records grows exponentially, , found other way of querying against database, odbc connector. using ado.net + netconnector solution had o/rm , didn't have write queries, while odbc makes code awful (since didn't switch odbc, have linq queries , plain sql queries inside code). is there solution (free or not) can have both o/rm without need of writing sql queries myself , speed of odbc? what should doing using mysql ado.net connector , storing queries in database in form of stored procedures . version 6.0 of mysql connector supports the entity framework . if interested in using entity f...

executing a python script on windows using java Runtime.exec -

i have python script runs on windows , uses win32 extensions , wmi information. if run script using command line, executes perfectly. but, if try run same script using java runtime.exec("python myscript.py") seems blocked on waitfor(). code this: process p = runtime.getruntime().exec("python myscript.py"); int exitcode = p.waitfor(); if try use same java code simple python script like print "hello world" i exitcode 0, means works. can execute python script imports wmi library, using java runtime.exec()? thanks one reason io buffers full , need flushed, try flushing both stdout , stderr process in java code ( example code ). alternatively, try redirecting output nul or text file 1 of following arguments exec: cmd.exe /c python myscript.py > nul 2>&1 cmd.exe /c python myscript.py > output.txt 2>&1

objective c - Run a binary from .app's package contents -

can have binary files .sh part of .app in "package contents". i have .app has 2 buttons start/stop kicks off process start server. keep clean, store start/stop shell scripts within .app. can execute shell scripts .app? on mac, yes: use nstask class’s +launchedtaskwithlaunchpath:arguments: method (for example), after retrieving path binaries 1 of methods on nsbundle’s— -resourcepath , -bundlepath , -pathforresource:oftype: , or whatever. on ios... no. nstask isn’t available.

Rails - How to use active record to query with a nested condition? -

lets have 3 models user(id, guest(boolean)) belongs_to :room_user room (id) roomuser (id, room_id, user_id) has_many :users right can do, room.room_users , associated users in room. that's doable rails. what want room.room_users_active so in room model have: def room_users_active self.room_users.where(:......) end the challenge here want condition reach user table. , following: return room_users user not guest (user.guest == false). ideas? thanks not tested, should work, try , let me know def room_users_active room_users.joins(:users).where('user.guest = false') end fixed wrong method call see here

java - How do I open, write and save a file while avoiding errors? -

i need erase file in program. solution have erase() method so: public static void erase(string string) { filewriter fw = null; try { fw = new filewriter(string); fw.write(new string()); } catch (ioexception ie) { e.printstacktrace(); } { fw.flush(); fw.close(); } } several problems here: if fw not initialize (for whatever reason, missing file, invalid persmissions, etc) when try close in finally block, there nullpointerexception. if don't have block, might throwing nullpointerexception reason above. if close file inside try block, might leak resource if file opens, doesn't write. what other problems overlooking , how can harden method? you can wrap functionality in if-statement: if(fw != null){ fw.close(); } this ensure if file ever opened, closed. if wasn't opened in first place, won't anything, want. also, i'm not sure if it's posting, it's not advisable p...

Best way to get rows changed in an sqlite db -

i'm watching sqlite db app uses. i want know changes have been made since last checked. i can dump sql , diff against last dump, seems there should better way. is there? thanks, kent ps not coy, specifics: i'm managing photos shotwell, has great gui. i'm mirroring shotwell's db in postgresql, i've restructured , augmented liking. after shotwell session, involves adding, tagging, adjusting ... want apply changes postgres. add field named _changed table(s). on every manipulation ( update , insert into ...) of row set field current timestamp. can check rows have been updated since.

linux - Passing one shell script variable to another shell script -

i trying access 1 script variable script example, script1.sh: export a=10 export b=20 echo "testing" exit script2.sh: . script1.sh echo $a the problem involved here able access variable 'a' script1 in script2 executing all commands written in script1.sh annoying. want access exported variables in script1 , donot want run commands in script1 while calling in script2 . kindly help! thanks, karthik assigning variable command. unless you're prepared write bash parser in bash, want cannot done.

caching - Facebook API - cache response on server -

i've got app/site makes few calls out facebook api upon specific user interaction. wondering best approach caching responses of these api calls on server. my current setup node.js running express , mongodb storage. should shove api response mongo timestamp, , before making future api calls check in there first? i'd use redis ( http://www.redis.io ) or memcached ( http://memcached.org/ ) caching needs. make key md5 hash of whatever api call you're making , check cache if key exists before hit api.

iphone - Local Database iOS -

i have 15k entries , want store them in local database. further in ios app m going use data. local database should prefer in terms of performance also? how should proceed? how maximum data can store locally? thanks in advance i have used core data same scenario this. have found below tutorial useful http://developer.apple.com/library/ios/#documentation/datamanagement/conceptual/iphonecoredata01/introduction/introduction.html

iphone - How to effectively transfer real time video between two iOS device (Like facetime, skype, fring, tango) -

i know how frame ios sdk. [how capture video frames camera images using av foundation( http://developer.apple.com/library/ios/#qa/qa1702/_index.html)] it's pixel, , can transfer jpeg. what way want transfer video this: one ios device a: get pixel or jpeg call function -(void)captureoutput:(avcaptureoutput *)captureoutput didoutputsamplebuffer:(cmsamplebufferref)samplebuffer fromconnection:(avcaptureconnection *)connection using existed technology encoding h.264 - ffmpeg encapsulate video ts stream run http server, , wait request the other ios device b: http request a(using http instead of rtp/rtsp) so question is, need use ffmpeg h.264 stream or can ios api? if use ffmpeg encode h.264(libx264), how that, there sample code or guideline? i've read post what's best way of live streaming iphone camera media server? it's pretty discussion, want know detail. the license ffmpeg incompatible ios applications distributed through app sto...

When to go for stored procedures rather than embedded SQL -

i confused when go stored procedures rather embedded sql in code when googled out, found out these points they allow modular programming. they can reduce network traffic. they can used security mechanism. is please tell me how network traffic related ?? they can reduce network traffic returning required data client. or turn around; design/coding practice can waste network traffic select set of data db, return client , processing there on of dataset. if working on of data set better traffic perspective not send client data not being processed

javascript - Replace an image at the DOM -

i looking replace particular image when click on , change active image. click on other image, clicked image becomes active , other image becomes inactive again. the html markup looks this: the html using is: <ul id="weeklyprizeblockthumb"> <li class="active"> <img src="images/bts/bts_overlay_wp_box_thumbw1.jpg" alt="week1" id="week1" /> <p class="text"> <span>gearing school:</span> <span>$100 of mead® school supplies!1</span></p> </li> <li> <img src="images/bts/bts_overlay_wp_box_thumbw2.jpg" alt="week2" id="week2" /> <p class="text"> <span>sticking schedule:</span> <span>$100 gift card container store®!</span></p> </li> <li> <img src="images/bts/bts_overlay_wp_box_thumbw3.jpg" alt="week3" id...

How to update a number of Rows in a Table using Linq -

i using following code update usersession column of activities. following code return records if expirytimestamp less current date. update usersession column 0 returned recods in table. .now wants if there 100 records returned these should update @ 1 time instead of using foreach. posible in linq cachedatadatacontext db = new cachedatadatacontext(); var data = (from p in db.activities p.expirytimestamp < datetime.now select p).tolist(); data.foreach(ta => ta.usersession = "0"); db.submitchanges(); in short, no: linq-2-sql not batch updates out of box. (i not sure foreach work wrote - not think - similar , work) foreach (var x in data) {x.usersession = "0";} db.submitchanges() but, if this, linq-2-sql send update statement each record database. example of 100 records returned 100 individual updates send database.

android - Customize Media Controller -

i m using videoview display video. my requirement mediacontroller wid play/pause, stop, & volume contoller .. tried mediacontroller mc = new mediacontroller(this); view mmediacontrollerview = (view)findviewbyid(r.id.mediacontroller1); mc.setanchorview(mmediacontrollerview); videoview.setmediacontroller(mc); adding imageview layout seems have no effect on mediacontroller need guidance/hint proceed further... thanks. you have write mediacontroller class on again extending framelayout .the layout uses should customised. copy android source code of mediacontroller class , proceed ahead.

javascript - Sort divs using jQuery based on child elements content -

i'm trying sort n amount of divs in page based on content inside other elements in div. here html code looks 1 div block (in 1 page there several need re-order / sort price or alphabetically. <div class="productboxwrapper"> <li> <img src="my-product-image.jpg"></a> <div class="product-info"> <h4> <!-- need sort divs product name --> <a class="producttitleforsorting" href="product-page-link">product name</a><br> </h4> <div class="product-price"> <span id="listprice">suggested retail: $xx.xx</span> <span id="lowestprice">as low as: <!-- need sort divs product price --> <span class="productpriceforsorting">$xx.xx</span></span> </div> ...

asp.net mvc 3 - Display standard razor/mvc 3 validation messages displayed in another language -

what need install built-in validation messages of mvc displayed in current ui culture of request? resource files maybe separate download? e.g. validation message "the email field required." should displayed in german when culture set de-de. edit: need bit clearer. i've done complete localisation of custom validation messages allready using attributes custom messages. ones still need translated out-of-the box ones. e.g. [required] public string email {get;set;} produces validation message email field required. i'd have in german , italian also, without having go through every single property. (i expecting there language pack or similar; google wasn't able produce though..) i recommend checking out following guide .

javascript - getElementById replace HTML -

<script type="text/javascript"> var haystacktext = document.getelementbyid("navigation").innerhtml; var matchtext = '<a href="http://mydomain.co/?feed=rss">subscribe rss</a>'; var replacementtext = '<ul><li>some other thing here</li></ul>'; var replaced = haystacktext.replace(matchtext, replacementtext); document.getelementbyid("navigation").innerhtml = replaced; </script> i'm attempting try , replace string of html code else. cannot edit code directly, i'm using javascript alter code. if use above method matching text on regular string, such just 'subscribe rss', can replace fine. however, once try replace html string, code 'fails'. also, if html wish replace contains line breaks? how search that? <ul><li>\n</li></ul> ?? what should using or doing instead of this? or missing small step? did search ar...

java - How to create a new directory in grails application to store jasper report files those can be downloaded by user -

i want create new directory store pdf reports generated jasper reports , should accessible users download for example: exporting file called "pdfreport20110804788.pdf".when put file in directory .i set things in controller method , need file created returned groovy method new directory created , exported pdf file file should returned controller calling method further operations response.setcontenttype("application/octet-stream") response.setheader("content-disposition", "attachment;filename=${file.getname()}") response.outputstream << file.newinputstream() so ,i have been trying these thing creating file using createtempfile method , returning file controller file getting downloaded c:\ ... location without asking download or open .can 1 please give me solution this there 2 things need aware of: 1.) files generated on server's disk cannot directly accessed user on web site . have deliver files through browser via ...

database design - PHP web app internationalization -

i building php web app requires internationalization. have decided use get-text system related strings , perhaps database tables user generated content. for example, user might able post blog post. should able post different versions of post in different languages. can implement storing posts in posts table column denoting language. the difficult bit trying internationalize system strings stored in database. for example, have table stores privileges. each privilege should have string describes privilege does. at moment, stored in table this: app_privileges id privilege some other columns description i plan use application poedit generate gettext files. able search through php files grab strings. in cases string stored in database, can fair bit of work extract string transation. tricks , solutions handling this? finally, lets have data types , forms users can create , define in app. example, defining "product type" shopping cart. means product have own...

iphone - how to decrease the height of table of class UITableViewController? -

i using table view in view controller uitableviewcontroller . trying set height of table by [self.tableview setframe:cgrectmake(0, 0, 320, 300)]; [self.tableview setbackgroundview:backimageview]; [self.tableview setseparatorcolor:[uicolor blackcolor]]; but not working. doesn't have xib there way that? for know can't (if push/showmodal tableviewcontroller), view (in case tableview) of viewcontrollers resized automatically screen size (- status bar, navigationbar , tabbar). can set contentoffset , contentinset . in case should work (might need change values): self.tableview.contentinset = uiedgeinsetsmake(0 /*top*/, 0/*left*/, 160/*bottom*/, 0/*right*/);

help needed to develop an algorithm -

hi need small develop algorithm.. if there algorithm existing please update me. this want do. i have 4 input text box , 1 out put text box. in input text box want give 4 characters. example a, a, a, b. output textbox should give me answer "a". i want check entered character in input textbox , want display it. sample input , output required (text1,text2,text3,text4 = output) a,a,a,a = a,b,a,a = a,a,b,b = a,a,b,a = c,c,a,c = c this program writing in c# visual studio 2010 ultimate.. advise welcome.... thanks.. ok, i'll go tact; pseudo code. if can't turn real code, go hand textbook teacher , tell him you're not suited class. define dictionary key 'char' , value integer each textbox read character textbox increment 1 dictionary value associated character find highest value in dictionary output associated key

iphone - How To Get Name From NSArray -

i have nsfetchrequest search of core data entities. finds them fine, want set cell's text entity's name attribute. i have setting object title, instead of name attribute, how can fix this? nsfetchrequest *fetchrequest = [[nsfetchrequest alloc] init]; nsentitydescription *entity = [nsentitydescription entityforname:@"routine" inmanagedobjectcontext:self.managedobjectcontext]; [fetchrequest setentity:entity]; nserror *error = nil; nsarray *results = [managedobjectcontext executefetchrequest:fetchrequest error:&error]; self.routinearray = results; [fetchrequest release]; cell.textlabel.text = [self.routinearray objectatindex:indexpath.row]; try : cell.textlabel.text = [[self.routinearray objectatindex:indexpath.row] name]; edit if routine instances in routinearray (given name, suppose) : // routine instance routine *r = [self.routinearray objectatindex:indexpath.row]; // got instance, set want on r... // ... // , set name text textlabel ...

c# - Constructor injection with non-dependency parameters -

i have interface itradingapi so: public interface itradingapi { iorder createorder(...); ienumerable<symbol> getallsymbols(); // ... } this meant facade different apis of vendors of trading software. view model has dependency on trading api in constructor: public class mainviewmodel { public mainviewmodel(itradingapi tradingapi) { /* ... */ } // ... } i use ninject ioc container, create instance of view model this: var vm = kernel.get<mainviewmodel>(); now, problem: the implementation of itradingapi might need additional parameters work. example: one vendors api uses tcp/ip internally, need hostname , port. another vendor uses com object. here don't need info. a third vendor needs username , password of account. in spirit of not allowing incomplete objects, added these parameters constructors of concrete implementations. now, not sure, how work. clearly, these additional parameters not belong interface, because speci...

asp.net mvc - Windows Workflow usage in large web applications -

although, of examples checked on internet use wf deal wizard-like steps or designing workflow-based ui, , since windows workflow can deal state machines, , if say, have website stackoverflow.com, in areas of application use workflow foundation? examples: a user's question has got 10 up-votes, give owner bronze badge. a question has got 10,000 views, set top_question flag. should these small (but there many of them) events should handled using windows workflow? there wf components placed on top of built-in wf ease such operations? i have yet see successful application build workflow engine wf, biztalk or of other engines out there. successful mean: made production , resulting application easier maintain if had been built without out of box workflow engine. udi dahan posted a interesting blog on topic elaborates why stuff works on demos not in real life. to fair, should clarify not have hands on experience on wf, did play biztalk while ago , found on top f...

javascript - Jquery div layers animate problem -

i started learning jquery , problem baffles me. have `div`s in container , when mouse on them resizes div , shifts divs in front offset. on mouseout, shifts div subtracting offset. current code: <html> <head> <script src="http://code.jquery.com/jquery-latest.js"></script> <script language="javascript1.2"> function resize(obj) { shift(parseint(obj.id[obj.id.length-1])); $("#"+obj.id).height("100px").width("100px") ; } function shift(id) { for(var i=id+1;i<=4;i++) { $("#hello"+i).stop().animate({"left":"+=60px"},1000) ; } } function shrink(obj) { $("#...

c# - extract data point from tiff picture -

Image
i did google seraches not find answer. possible extract data points tiff image? if vector type format should possible reckon ... programmer (c# preferably). thanks. christian its not me "data" in case. hope tiff file format specification http://partners.adobe.com/public/developer/en/tiff/tiff6.pdf

javascript - Sending all input fields with jquery .post() -

i have collected values of input field array follows: $( ".formbox" ) . each( function(id,elem){ form_fields[ "input-" + $( elem ) . attr( "id" ) ] = $( elem ) . val( ); }); $.log( "collected:", form_fields ); this work, , try passing array using post $.post( "server.php", { fields: form_fields }, function(ret) { if (!ret.success ) alert ( "error! reload please!" ); else { } }, 'json' ); however while retrieving, firebug indicates fields empty as understood need serialize array or not use @ all. use instead? please tell doing wrong? ---------- added ---------- ...i found this form_fields = {}; :) i don't understand how solved problem please tell me difference between array , {}? {} in js ? {} used creating objects , [] used arrays indicate indexes. difference that. sample code: var obj = {n...

Developing Google gadgets with GWT -

i created gadget using getting started gadgets , gwt i want know: is possible work on gadgets in development mode? want change code , see results. or need compile , publish gadget every time change code? i want gwt gae application both normal gwt app , google gadget. when user enters http://mygadget.appspot.com/ want him see normal gwt app. when user access http://mygadget.appspot.com/axogadget/com.axdms.gadget.client.axobjectgadget.gadget.xml gets gadget. posible? or has 2 different gae applications? (normal gwt app , gadget have different functionality). multiple entry points? yes using apache shinding, still hassle. multiple entry points can work have differentiate on how make calls server. normal gwt app can use rpc example gadgets must use ioprovider.

excel - Reading .xlsx format in python -

i've got read .xlsx file every 10min in python. efficient way this? i've tried using xlrd, doesn't read .xlsx - according documentation does, can't - getting unsupported format, or corrupt file exceptions. best way read xlsx? need read comments in cells too. xlrd hasn't released version yet read xlsx. until then, eric gazoni built package called openpyxl - reads xlsx files, , limited writing of them.

asp.net 4.0 - Add a config file for a new configuration in Visual Studio -

i have web app default web.config file has 2 "child" (or how call them?) config files: web.debug.config , web.release.config. but i'll need deploy qa , staging environments, each of have separate sqlserver instances require different connections strings. i'll need separate configurations these, i've added configurations in build > configuration manager. question : how add "child" config file each new configuration? right-click on config file, chose "add config transforms."

mysql - How to execute composite sql queries in java? -

how can execute following query , retrieve result via prepared statement: insert vcvisitors (sid) values (?); select last_insert_id(); is there way execute both 2 statements @ once? i've tried following: connection con = dbmanager.getconnection(); preparedstatement ps = con.preparestatement( "insert vcvisitors (sid) values (?); select last_insert_id();"); ps.setint(1, 10); resultset rs = ps.exequtequery(); rs.next(); return rs.getint("last_insert_id()"); but gives me error executequery can't execute such query, i've tried replace executequery following: ps.execute(); rs = ps.getresultset(); but gives me sql syntax error: you have error in sql syntax; check manual corresponds mysql server version right syntax use near 'select last_insert_id()' @ line 1 but there no problems executing query "insert vcvisitors (sid) values ('10'); select last_insert_id();" directly mysql console. while updati...

matlab - Extending a line by dragging another object in a figure -

i have functions moving objects around in figure. figure populated lines. i'm trying attach 1 vertex object (or position fixed relative object) when drag object, line extends it. wouldn't have trouble doing this, imline(.) function returns line no 'position' property. there other way this? you can , set position of underlying line graphic object using getposition , setposition methods of imline object . these should suffice update line drag attached object.

javascript - loadString(...) - access to JS functions -

i'm loading website using htmlloader.loadstring(somehtml) . there included js sources. there chance access functions inside js file? i set property placeloadstringcontentinapplicationsandbox true. documentation best friend friend. http://livedocs.adobe.com/flex/3/html/help.html?content=programminghtmlandjavascript_02.html more specifically, http://livedocs.adobe.com/flex/3/html/help.html?content=programminghtmlandjavascript_07.html

asp.net - dorpdownlist SelectedIndexChanged breakpoint not trigged -

i have breakpoint on dropdownlist control on asp.net page. not activated when select item listbox. missing here? onselectedindexchanged="ddlprojectsearchid_selectedindexchanged" protected void ddlprojectsearchid_selectedindexchanged(object sender, eventargs e) { clientscript.registerclientscriptblock(typeof(string), "key", string.format("alert('{0}');", datetime.now.day), true); } set autopostback="true" on dropdown.

winforms - Transfer file(s) to a folder on a server -

i have been trying come strategy allow me transfer file on network (or internet in near future) client server's folder (db server, in case). have client-server application running. several clients connect server , perform tasks. server has sql server 2008 db well. not want upload file database. know using credentials and/or impersonation, 1 can transfer file using system.io library network-shared folder. now, client on company intranet. therefore, communication on local network , no internet involved. nevertheless, there prospect of involving wp7 client applet well. if case, client want use system on internet well. other communication, have expose sql server on internet getting fixed/static ip address. the thing bothers me file transfer. users upload cvs, legal documents (all in pdf only) folder on server. retrieve view them. wondering if there possibility involve socket programming , socket-server portion in windows service running on server. is viable approach? several us...

How to use a value in WHERE clause from a comma separated string in a MySQL Table? -

how records table contains 24 deptid. i've added table structure. sql query id , name contains 24 deptid? users: ------ id name deptid --- ----- ------- 1 balaji 1,136,12,53,48,2,153,45,78,53,10,3,143,53,46,49 2 scott 24,90,120 3 balraj 43,9,24,901 we can use find_in_set function in mysql. $deptid="24"; query is select * users find_in_set('$deptid', deptid);

javascript - I want to define a css stylesheet or add a body class dependant on viewport size -

i have wordpress website wish provide content via iframe on facebook.. without using wordpress plugin, know if provide function in jquery says if viewport equal 520px either load css file or add body class.. also, if viewport = 520px hide element.. i think can done after lot of searching, cannot seem find definative answer.. if can help, appreciate it.. kindest regards, danny for css, use media queries, eg: <link href="bigscreen.css" media="screen , (min-device-width: 520px)" rel="stylesheet"> note ie 6, 7, , 8 don't support this, ie use: <!--[if lt ie 9]> <link href="megafubarbrowser.css" media="screen" rel="stylesheet"> <![endif]--> for js, use code like: if (screen.width <= 520) { $('.bigstuff').hide (); }

video streaming - darwin not able to stream uploaded 3gp files from rails -

i trying upload 3gp files rails application on ami instance using paperclip. move 3gp file darwing streaming server folder stream it. have better identification of file names , has been prepended ids'. now when trying play video through rtsp link on mobile, not able play video. interestingly, when download video local machine , play vlc - able that. what missing here. to stream 3gp or mp4 file via darwin streaming server, must ensure media file hinted. add hint track 3gp or mp4 file, can use mp4box http://gpac.wp.institut-telecom.fr/mp4box/ mp4box -hint sample.3gp

android - onComplete method is not called on htc desire -

i implementing facebook login facility on android seems work ok on emulator , on google nexus device. authorization seems cancelled user on htc desire s , oncomplete() never called. difference found htc has built in facebook application. code using: private void login(){ facebook.authorize(this,new string[] {"email"}, new facebook.dialoglistener() { @override public void oncomplete(bundle values) { log.d("auth","oncompletecalled"); } @override public void onfacebookerror(facebookerror error) {} @override public void onerror(dialogerror e) {} @override public void oncancel() { log.d("auth","cancelled"); } }); the error message comes section of facebook sdk code: } else if (resultcode == activity.result_canceled) { // android error occured. if (data != null) { log.d("...

How to overload a JavaScript function? (changing Slickgrid's editor) -

i'm using slickgrid , change behavior of editor. instead of copy&paste tried overload 1 of functions doesn't work. cannot read loadvalue function. loadvalue defined (some code omitted) integercelleditor : function(args) { this.loadvalue = function(item) { defaultvalue = item[args.column.field]; $input.val(defaultvalue); $input[0].defaultvalue = defaultvalue; $input.select(); }; } what tried is: function tristateintegercelleditor(check_field) { var f = integercelleditor; var f_loadvalue = f.loadvalue; f.loadvalue = function(item) { f_loadvalue(item); if (check_field) { if (!item[check_field]) { $select.disable(); } } }; return f; } is there way substitute function? you need f_loadvalue.call(this, item); otherwise old loadvalue get's call...

How to use HTML5 File API with Unobtrusive JavaScript? -

i use html5 file api unobtrusive javascript. can working calling javascript functions html. there way use file api unobtrusive javascript? the file api not supported browsers, have tried in google chrome , in firefox. from documentation works: <input type="file" id="input" onchange="handlefiles(this.files)"> and have tried unobtrusive javascript doesn't work: window.onload = function() { var input2 = document.getelementbyid('input2'); input2.addeventlistener('onchange', handlefiles); } a complete example below, , testable on jsfiddle . <!doctype html> <html> <head> <meta charset="utf-8"/> <script> window.onload = function() { var input2 = document.getelementbyid('input2'); input2.addeventlistener('onchange', handlefiles); } function handlefiles(e) { alert('got files'); } </script> </head> <body> <h1>test...

Python copy on PIL image object -

i'm trying create set of thumbnails, each 1 separately downscaled original image. image = image.open(path) image = image.crop((left, upper, right, lower)) size in sizes: temp = copy.copy(image) temp.thumbnail((size, height), image.antialias) temp.save('%s%s%s.%s' % (path, name, size, format), quality=95) the above code seemed work fine while testing discovered images (i can't tell what's special them, maybe png) raise error: /usr/local/lib/python2.6/site-packages/pil/pngimageplugin.py in read(self=<pil.pngimageplugin.pngstream instance>) line: s = self.fp.read(8) <type 'exceptions.attributeerror'>: 'nonetype' object has no attribute 'read' without copy() these images work fine. i open , crop image anew every thumbnail, i'd rather have better solution. i guess copy.copy() not work pil image class. try using image.copy() instead, since there reason: image = image.open(path) image = image.crop...

asp.net - How to reduce total waiting time of a web page? -

i working on website. of pages on website rendering slow, taking arround 16-20 seconds. i searched on internet optimize web pages. everyone says reduce size of web-page or bunch static contents (that is, javascript , css) in 1 file reduce number of http requests server while downloading contents. but have problems regarding approach: the source code massive, , dont know impact of merging javascript , css file 1 file (which functionality affected javascript clashes?) the maximum time waiting time page (around 14 seconds), , have tested total responce time of database server , other processes @ local end, minimal of around 1 second. also, have tested page staging server, there it's working fine 2-3 seconds of downloading time only, @ production server it's taking arround 16 seconds. if it's problem of server, page on staging server working fine not @ production server what code optimzation minimal code changes be? ...

linker - What's the difference between "gcc -lname" and "gcc libname.so ..." -

it seems me both work, difference? does gcc libname.so ... statically links libname.so or not? gcc -l looks both static , dynamic libraries (unless -static given) in library search path. gcc ... libname.so links dynamically libname.so in current directory.

c# - deploy application dependencies to program folder or GAC -

possible duplicate: when should deploy assemblies gac? how deploy applications? copy necessary dlls (your own, 3rd party, etc.) application folder , finished or deploy or dependent dlls gac is there best practice of above solutions use , dlls go application folder vs gac? i using clickonce. so, not worry versioning, gac , other stuff, create additional folders in project solutions copy 3-d party assemblies into, , not have of difficulties updates, besause easy implement custom update system using built-in update system , reflection (for custom versioning), can find information clickionce deployment , custom updates for simplicity, recommend use directory structure: <assembly set>\<assembly name>\<assembly version>\ for example: media\ui\1.0.0.0\ui.dll or assemblies\libvnc\1.11.10\libvnc.dll

php - Anonymous function for a method of an object -

possible duplicate: calling closure assigned object property directly why not possible in php? want able create function on fly particular object. $a = 'a'; $tokenmapper->tokenjoinhistories = function($a) { echo $a; }; $tokenmapper->tokenjoinhistories($a); with $obj->foo() call methods, want call property as function/method. confuses parser, because didn't find method name foo() , cannot expect property callable. call_user_func($tokenmapper->tokenjoinhistories, $a); or extend mapper like class bar { public function __call ($name, $args) { if (isset($this->$name) && is_callable($this->$name)) { return call_user_func_array($this->$name, $args); } else { throw new exception("undefined method '$name'"); } } } (there issues within written example)

javascript - dynamically load pages from Homepage -

i have menu user select page want @ on homepage. please can show me how load page in javascript once user selects particular option menu? want page loaded in div or groupbox menu list should static pages. bunch. perhaps take @ jquery tabs: http://flowplayer.org/tools/tabs/index.html hope helps! n.s.

scripting - How to Pass parameters for a Ant script , which is invoked via shell script? -

i need invoke ant script via shell script. let consider parameters ant script a,b,c. how can pass parameter variables? must provide parameters ant vis invoke shell script. can me on this? do mean assigning value property command line? if so, try -dpropertyname=itsvalue for example, <project> <target name="hi"> <property name="person" value="world"/> <echo message="hello ${person}"/> </target> </project> and then ant -dperson="merryprankster" hi yields [echo] hello merryprankster

Where are the dlls -WebDriver.Common and WebDriver.Firefox in Selenium Web Driver? -

i running tests on selenium web driver. looks need dlls webdriver.common.dll, webdriver.firefox.dll. had downloaded web driver api link http://code.google.com/p/selenium/downloads/detail?name=selenium-dotnet-2.1.0.zip&can=2&q= , when unzip, not find dll mentioned in subject. i using visual studio 2010 & creating class library. please let me know if there link download mentioned dll or way working. webdriver.common.dll, webdriver.firefox.dll, , of other browser-specific assemblies combined single webdriver.dll assembly final 2.0.0 (and later) releases. should have create reference webdriver.dll able use of functionality of selenium webdriver api.

c++ - Algorithm to make numbers from match sticks -

i made program solve this problem acm. matchsticks ideal tools represent numbers. common way represent ten decimal digits matchsticks following: this identical how numbers displayed on ordinary alarm clock. given number of matchsticks can generate wide range of numbers. wondering smallest , largest numbers can created using matchsticks. input on first line 1 positive number: number of testcases, @ 100. after per testcase: one line integer n (2 ≤ n ≤ 100): number of matchsticks have. output per testcase: one line smallest , largest numbers can create, separated single space. both numbers should positive , contain no leading zeroes. sample input 4 3 6 7 15 sample output 7 7 6 111 8 711 108 7111111 the problem it's way slow solve 100 matchsticks. search tree big bruteforce it. here results first 10: 2: 1 1 3: 7 7 4: 4 11 5: 2 71 6: 6 111 7: 8 711 8: 10 1111 9: 18 7111 10: 22 1...