Posts

Showing posts from January, 2011

objective c - Bold + Italic Shortcuts in Document-Based Applications -

i've been reading using first responder proxy object, , dragging connections buttons in order create usable actions (align left, right, etc). however, default, first responder doesn't contain bold , italic actions. tried adding these actions opening menu.xib , dragging (font > bold) menu item first responder , setting boldit function (custom) overwrites existing action (font manager: addtrait). there way efficiently add bold/italic button on document.xib? seems lot of work common. new obj-c best, zach in menu xib, there object (the bold menu item), tag 2, , action connected -addfonttrait: method of nsfontmanager instance. you need same thing in document xib. add nsfontmanager object; create bold button; set tag 2; , connect action -addfonttrait on nsfontmanager.

ide - Is there a way to directly edit files on a server? -

is there anyway directly code on server, meaning open file server , save there? or there method faster traditional ftp automatically syncs server when save locally? using svn option. read this: combined svn ftp system

What is the de facto library for creating Python Daemons -

i attempting use python-daemon library seemed me safest way create daemon without forgetting anything. documentation quite poor, being pep 3143 . on other hand , have found lot of links sander marechal's a simple unix/linux daemon in python . looks nicer solution or though have not yet attempted use it. edit: have used sander marechal's solution , seems work nicely. so de facto way in python community create daemon, 1 of these libraries, or doing (forking twice etc.)? also, think library pep far better choice since closer comprehensive way of creating daemon (or @ least more standard way) other solution. deal python-daemon package, ever included in standard library? i went sander marechal's a simple unix/linux daemon in python , is simple, , work creating subclass , overriding run() method, feels natural way things (rather with context: approach of python-daemon module.

c - While creating IP, IGMP packets using Raw Sockets, How to fille the hex value in those packets? -

i have 1 ip packet, includes igmp packet. want simulate using raw socket programming. checksum field of ip packet e1c9, how assign value in programming. tried iphdr->iph_chksum="e1c9"; also iphdr->iph_chksum=57801; is above thing right? it not working properly, please tell me exact way? thanks in advance....... :) the c syntax hexadecimal values 0xe1c9 in case. should ensure using correct byte order, need pass value through htons

jsp - How to loop the value stored in session? -

sorry interrupt of you. i have question session. in case, need check session has stored value or not. if session not null, want loop value comparison. now, use if statement check last record of book id repetitive or not. but don't know how use loop check there book id repetitive or not. would 1 provide advice me acheive goal? many thanks. here source code: <%@ page contenttype="text/html; charset=big5"%> <%@ page import="java.io.*" %> <%@ page import="java.sql.*" %> <%@ page import ="javax.sql.*" %> <%@ page import="java.util.*" %> <%@ page import="java.lang.*"%> <%! public class bookinfo { private string id; private string name; private int count; public bookinfo(string id, string name, int count) { this.id = id; this.name = name; this.count = count; } public string getid() { return id; } publ...

javascript - jQuery ways to dynamically .append a div to the dom, and then find it later without setting an ID, class, or anyway to indentify it -

update: contributed, it's appreciated, kind , generous , of deserve dear respect. cheers. note: i'm making simple jquery tooltip plugin, tooltip fire on mouseover. mouseover create instance of div tool-tip specific each anchor launched div tool-tip. each anchor class .c_tool have own created div erase after mouseout. anyway details irrelevant. important how create div .append() or .add() on , find way call , apply actions div without setting identifier (id), class, or means identify it. i know theres way find div counting, if gave every created div same class , counted them find one, don't know if efficient method why i'm asking help. i'm not going post whole plugin script thats unnecessary, i'll paste simplified version. <a href="#" class="c_tool">hover me</a> <a href="#" class="c_tool">hover me</a> $(document).ready(function() { obj = $('a.c_tool'); obj.mouseover...

android - how to split main.xml to other xmls? -

i have main.xml , large file, want split of components(some layouts) other xml can link main.xml itself. possible android ? you can use <include layout="@layout/commonlayout" android:id="@+id/id" /> refer import xml xml

wpf - Is it possible to set the startup form to be a static string value? -

as know can specify view start setting property startupuri below code. <application x:class="someclass" xmlns ="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" startupuri="mainwindow.xaml" > </application> my question: can put in static string value view name, ie. mainwindow.xaml ? i tried below code doesn't work. please share if know how to. thank you! <application x:class="demo.wpfskill.app" xmlns ="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:mypublicstaticclassnamespace" startupuri="{x:static member=local:mypublicstaticclass.astaticvalue}" > </application> edit purpose: p...

emulation - Emulating density of 320 dpi on android emulator -

we're trying emulate devices new density of 320 dpi in android 2.3 - such archos 101, , can't seem able define emulator such density, after downloading latest 2.3 sdk. i appreciate ideas on 1 :) many thanks! in avd manager if choose built-in skin abstracted lcd density ignored , set density described here: emulator skins (from http://developer.android.com/tools/revisions/platforms.html ) the downloadable platform includes following emulator skins: qvga (240x320, low density, small screen) wqvga400 (240x400, low density, normal screen) wqvga432 (240x432, low density, normal screen) hvga (320x480, medium density, normal screen) wvga800 (480x800, high density, normal screen) wvga854 (480x854 high density, normal screen) wxga720 (1280x720, extra-high density, normal screen) wsvga (1024x600, medium density, large screen) wxga800-7in (1280x800, high density, large screen) new wxga800 (1280x800, medium density, xlarge screen) if wish set own abstra...

DirectX 7 & VB6 on windows 7 -

i have small program in vb6 uses directx 7. i'm after 10 years trying run on windows 7. possible run old program on win 7? thanks. according microsoft knowledge base http://support.microsoft.com/kb/971028 can't run program on win7. having said can run via http://www.virtualbox.org/ far know virtual box has graphic accelerator support. hope helps!

c++ - Detecting connection requests without looping -

i need implement kind of server first waits users connect. use c++ , sdl_net, , code checks socket activity in loop. problem is consumes lot of cpu performance doing nothing actually, i'm wondering if there's way detect connection request/socket activity event or kind of callback registration? i'm not afraid of winapi solution welcome. thank in advance, vincent you can use sdlnet_socketset , create one, check sdlnet_checksockets , sdlnet_socketready

Connect to Google Calendar using Smack API in JAVA -

can tell me how connect google calendar server using smack api, if can that. what mean connecting google calendar using smack? smack let connect xmpp server, instant messaging means. if want similar http://clockwerx.blogspot.com/2008/10/interacting-with-google-calendar-via.html there 2 sides: implement bot , connect , talk it. speaking, here's code sample let connect gtalk: import org.jivesoftware.smack.chat; import org.jivesoftware.smack.chatmanager; import org.jivesoftware.smack.connectionconfiguration; import org.jivesoftware.smack.roster; import org.jivesoftware.smack.smackconfiguration; import org.jivesoftware.smack.xmppconnection; import org.jivesoftware.smack.xmppexception; import org.jivesoftware.smack.packet.message; import org.jivesoftware.smack.packet.presence; import org.jivesoftware.smack.proxy.proxyinfo; import org.jivesoftware.smack.connectionconfiguration.securitymode; import org.jivesoftware.smack.messagelistener; import org.jivesoftware.smack.sasla...

Django help_text -

i put text in form. class itemform(forms.modelform): alternative_id = forms.charfield(max_length = 60, required = false, help_text = 'valid wildcard search in format *xx, *xx*, xx*') however not appear on page. because may need template tag somewhere? edit : have written in template. <div id="location_header">search items</div> <div id="form_container"> <form action="." method="post"> <fieldset class="model"> {{ form.as_p }} {{ alternative_id.help_text }} </fieldset> <div id="form_footer"> <input type="submit" value="search" > </div> </form> </div> help text still not appear. there way write text, while allowing django generate form? putting {{ form.as_p }} (or {{ form }} ) in template should display help_text without additio...

How to implement ASyncTask in Android -

can tell me how update ui using asynctask , give example? i getting value 2 webservices. 2 webservices getting value in 2 arraylist on post method not return value rounding in loop. how return onpostexecutemethod? this async class: public class hometask extends asynctask<void,void,bundle> { private context ctx; public hometask(context context) { ctx = context; } @override protected void onpreexecute() { //super.onpreexecute(); //setcontentview(r.layout.splash); dlg = new progressdialog(getdialogcontext()); dlg.setmessage("loading...."); dlg.show(); //setcontentview(r.layout.splash); } @override protected bundle doinbackground(void... params) { bundle b=new bundle(); // todo auto-generated method stub try { webservice tableservice=n...

javascript - Selecting selectbox options by array values -

i getting values via json type ajax request jquery. when use alert(msg.options) alerts ["1","3","8"] if use below script select needed options, works. selects options have value 1 , 3 , 8 : $('#input_6').val(["1","3","8"]); but below script doesn't work if alerts same: $('#input_6').val(msg.options); how can fix this? thank you... try: $('#input_6').val($.parsejson(msg.options));

PHP MySQL – Once a Week Operations -

i've got database processes order - order inserted @ beginning of process if process not complete (they left page etc) "confirmed" field not filled in, allows admin know orders complete or not. at moment don't have luxury of adjusting way website manages data, can add sort of weekly cleanout of these database fields "confirmed" = 0. how go doing automatically? there way run query on weekly, monthly, yearly basis? edit: what if added website stored on restricted, shared server have no access box itself? you can use cron perform job. if need clean database incompleted orders show completed ones humans , don't export them other places (e.g. manager visits backend once per day , looks completed orders manually), suggest not hire cron this. can add few lines of code remove old entries database each time backend accessed. delete queries executed fast there no problems perfomance. real data deletion performed request. don't need have ...

When empty field comes, removed the row in the Grouped Table view in iPhone? -

i have displayed datas in grouped table view. data's displayed in table view xml parsing. have 2 section of table view, section 1 has 3 rows , section 2 has 2 rows. section 1 -> 3 rows section 2 - > 2 rows. now want check, if of string empty should remove empty cells, have faced problems, if have removed empty cell, changed index number. how can check, of field empty?, because times more number of empty field come, index position change. please send me sample code or link that? how can achieve this? sample code, - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section { if (section == 0) { if([useremail isequaltostring:@" "] || [phonenumber isequaltostring:@" "] || [firstname isequaltostring:@" "]) { return 2; } else { return 3; } } if (section == 1) { if(![gradyear isequaltostring:@" "] || ![graduate isequaltostring:@" ...

reporting services - How to send parameter List<string> from rdlc file to static method in customer assembly -

i use object datasource in reporting services .rdlc file. 1 of properties in object of type list<string> . try send parameter static method in custom assembly this: =mymodule.reportcode.getlistitemstring(fields!testlist.value,0) but not work, " #error ". does know have make work? you can work on entire fields collection , extract list inside custom assembly. yoo can create function in assembly like: public static double myfunction(fields pfields) and access columns using : if (pfields["mycolum"] != null && pfields["mycolum"].value != null) ... in report can call function using : code.mymodule.myfunction(fields) remember link microsoft.reportingservices.reportprocessing.reportobjectmodel assembly. hope helps..

Send email from access 2007 to outlook 2010 and avoid security question -

does know in access vba how send email using outlook 2010 avoid security pop up. have tried using fnsendmailsafe code error on blnsuccessful = objoutlook.fnsendmailsafe(strto, strcc, strbcc, _ strsubject, strmessagebody, _ strattachmentpaths) error 438 object not support property or method any ideas??? you'll need use outlook redemption objects. use send emails through outlook 2010 access 2007 know works. here's working code. you'll need have outlook redemption objects installed work on machine. have not made of sub's arguments optional. might consider changing function , passing false boolean value if error occurs somewhere in procedure. call subhandlesendingemail("display", "billgates@microsoft.com", "", "", "subject goes here", "my message body", "") private sub subhandlesendin...

How to use Zend Framework's Partial Loop with Objects -

i quite confused how use partialloop currently use foreach ($childrentodos $childtodo) { echo $this->partial('todos/_row.phtml', array('todo' => $childtodo)); } $childrentodos doctrine\orm\persistantcollection , $childtodo application\models\todo i tried doing echo $this->partialloop('todos/_row.phtml', $childrentodos) ->setobjectkey('application\models\todo'); but in partial when try access properties/functions of todo class, cant seem them ending either call undefined method zend_view::myfunction() when use $this->myfunction() in partial or if try $this->todo->getname() "call member function getname() on non-object". how use partialloops? try this echo $this->partialloop('todos/_row.phtml', $childrentodos) ->setobjectkey('object'); then in partial can access object this $this->object object name of variable object assigned to you can once...

scripting - Powershell Loop Freezing, waiting for enter when there is no input needed -

i have powershell script looping while connecting server, , checking see if jobs done. checks, sleeps 60 seconds , checks again. script keep checking until no jobs found. however, every , then, script hangs no reason. if hit enter, starts again. there no input in entire script. @ no point grab host. why doing , how can prevent it? it's no automation if have randomly hit enter no reason. btw, using powershell 2.0. thanks in advance is running in console window? if have managed start select (with mouse): title should have changed start "select". when selecting console window frozen... , if 1 character cell selected can hard spot...

JPA mapping issue with composite key -

i have below mapping @entity @table(name = "auctions") public class auction{ . . @onetomany(cascade = cascadetype.all, mappedby = "auction") private list<auctionparamvalue> auctionparamvaluelist; . . } @entity @table(name = "auction_param_values") public class auctionparamvalue { @embeddedid protected auctionparamvaluepk auctionparamvaluepk; @joincolumn(name = "auction_param_id", referencedcolumnname = "auction_param_id",updatable=false,insertable=false) @manytoone private auctionparam auctionparam; @joincolumn(name = "auction_id", referencedcolumnname = "auction_id",updatable=false,insertable=false) @manytoone @mapsid("auctionid") private auction auction; } @embeddable public class auctionparamvaluepk { @id @basic(optional = false) @column(name = "auction_id") private long auctionid; @id @basic(optional...

codeigniter session issue - some session info not sticking -

i'm using codeigniter session library hold data used in series of 3 pages , i'm experiencing strange behavior. session variables remain in tact values disapear. stranger: i'm trying store serialized array in session data , first item of array ends being stored in different variable? i've attached link starts @ first page in series possible click next page. i've printed user_session data @ top of both pages (the third page isn't set yet). http://playmatics.com/nypl/site/index.php/member_area/quest/accept_quest/12 sessions work everywhere else, example i'm using session store login data , works fine. i've attached controller , view below //controller: function accept_quest() { $assoc_quest_id = end($this->uri->segments); if(!isset($quest_id)) { redirect('member_area/quest'); //send message: no quest started } $quest_rows = $this->quest_model->get_quest_wi...

.net - split string before hyphen - asp.net c# -

i have string : 10989898 - test1 or example: 123178239182 - test2 i need output this: in first case: 10989898 in second case: 123178239182 means value before hyphen. how can that? string result = thestring.substring(0, thestring.indexof("-")).trim();

asp.net - Pdf creation Suggestions -

i have small web application based on asp.net 2010 manages invoices. after invoice saved, should automatically generate pdf file. which of following solutions fast , easy incorporate? use sql server 2008 reports use crystal reports 2008 , crystal reports 2008 vs 2010 use itextsharp create pdf file use xslfo create pdf file the point here dont know of above. 1 easy , quick learn , implement. there other solution achieve functionality? i prefer itextsharp flexible build pdf code need it. port of itext open source java library pdf not 100% intuitive (well c# perspective).. however said there lot of blogs , articles. i have found:- sql server 2008 needs lot of configuration , not quite give want. you need purchase crystal reports, said quite product itextsharp - free, easy set not 100% intuitive i have used , found tough going although possible desired ouput. edit for question regarding vs2010, used vs2005 number of years ago basic version came shi...

Jquery slide-out bottom-top mouseover menu problem on loading a new page -

i'm struggling converting menu mootools jquery. there various reasons why have switch js framework , need here because quite new jquery. first working mootools version on live site: http://www.kieleconomcis.de as can see menu moves on hover, reveals sub menu , stays up when click link , load page. now have convert jquery want able control heigth of each menu individually, a) looks more bar graph , b) can place 4 submenus :) i played around, copy&pasted, tried&errored , ended fiddle here. my problem - guess - have $('div.nav_body').hide(); need tell it has ignore effect if element before has id="visible" here of code can see need trigger: <h4 id="visible">Ãœber uns</h4> <div id="nav2-body" class="nav_body"> thanks adice. using :not() , :has() selector works: $('div.nav_container:not(:has(#visible)) .nav_body').hide(); the filter() method works well:...

NHibernate 3 LINQ provider creates non-ansi join syntax -

i'm pretty new linq (and nhibernate's linq provider) i have query joins 3 tables in grandparent-parent-child using many-to-one mappings. the actual sql nhibernate throwing out using old-school table1, table2, table3 join syntax. is there way make use ansi joins instead? (i see using fetch() this, syntax isn't standard linq stuff) cheers, mark no, it's not possible. keep in mind that, while ansi syntax cleaner , allows easier outer joins, it's semantically equivalent "old one" inner joins, shouldn't care.

.net - Change Microsoft Config File Encryption Method From TripleDES -

when encrypting ("protecting") microsoft config sections, looks xml below. follows (at least partially) w3 spec xml encryption. however, in xml below you'll see encryptionmethod under encrypteddata section "tripledes-cbc". able change more-secure alternative, aes, specified in aforementioned w3 spec well. in many calls microsoft's support engineers, near understanding question, less answering it. there way change encryption method? i forgot mention earlier set rsaprotectedconfigurationprovider, key appears encrypted rsa, whereas data encrypted 3des. <misccryptodata configprotectionprovider="someconfigprotectionprovider"> <encrypteddata type="http://www.w3.org/2001/04/xmlenc#element" xmlns="http://www.w3.org/2001/04/xmlenc#"> <encryptionmethod algorithm="http://www.w3.org/2001/04/xmlenc#tripledes-cbc"/> <keyinfo xmlns="http://www.w3.org/2000/09/xmldsig#"> ...

how to remove leading zeros from a session variable in jsp -

i have session variable -${redata.totalcharge} may have values 000000033 . when display value in jsp need 33 displayed. how do ? defined string data stored charecter in db2 database. integer.parseint(value) work. in preprocessing code, rather in jsp. also, <fmt:formatnumber /> should work. but - try fixing in database. shouldn't storing integers strings.

.net - Setup.exe installing prerequisites even if they are preinstalled -

i deploying .net application .net framework 4.0 , vs 2010 c++ redistributable prerequisites. when setup.exe runs in machine prerequisites satisfied bootstrapper install them again. is known issue? , what's correct way solve it? the solution edit bootstrapper product.xml file contain correct product code visual studio c++ redistributable. see post below contains steps fix this: visual c++ 2010 runtime libraries prerequisite keeps popping on vs 2010 created installer

python - how to group objects in reportlab, so that they stay together across new pages -

i'm generating pdf files using reportlab. have section repeated. contains of header , table: story.append(paragraph(header_string, styleh)) story.append(table) how can group paragraph table (in latex put them same environment) in case of page brake, paragraph , table stay together? paragraph floats @ end of 1 page , table starts on top of next page. you can try put them in keeptogether flowable, so: story.append(keeptogether([paragraph(header_string, styleh), table]) however aware that, last checked, implementation not perfect , still split items frequently. know job of keeping single flowable otherwise split, if say: story.append(keeptogether(paragraph(header_string, styleh)) then paragraph not split unless impossible not be. if keeptogether doesn't work you, i'd suggest creating custom flowable paragraph , table inside , during layout make sure custom flowable subclass not allow split up.

browser - programmatically clicking the "Image Submit" -

i trying make app on .net click "submit" button on web page. app filling out forms , clicking submit. of pages work of them have graphic "next" , "previous". there no submit type control on web page. source code can see doesnt show there js call or anything. web source looks graphic, , nothing else. i trying find out how click on graphic or find out doing calling javascript or can emulate it. does have ideas? the page adding click event handler somewhere else in javascript. if looking automation solution watin program @ automate firefox or ie using .net.

How does jQuery achieve making $ an alias for the jQuery function? -

i’m having little trouble wrapping head around $ sign being alias jquery function, particularly in plugin. can explain how jquery achieves aliasing: how define '$' alias jquery function? that's first question. secondly, can explain how/why following code works map '$' jquery function in plugin's definition , why if don't this, plugin collide other libraries might use dollar sign? (function( $ ){ $.fn.myplugin = function() { // awesome plugin stuff here }; })(jquery); a function, object in javascript, can assigned variable. variable can have name (that follows js variable naming rules). "$" satisfies naming rules, jquery function aliased "$" brevity. consider following example: var myfn = function() { alert('myfunc'); }; var $ = myfn; $(); // alerts 'myfunc'

c - AMD64 -- nopw assembly instruction? -

in compiler output, i'm trying understand how machine-code encoding of nopw instruction works: 00000000004004d0 <main>: 4004d0: eb fe jmp 4004d0 <main> 4004d2: 66 66 66 66 66 2e 0f nopw %cs:0x0(%rax,%rax,1) 4004d9: 1f 84 00 00 00 00 00 there discussion "nopw" @ http://john.freml.in/amd64-nopl . can explain meaning of 4004d2-4004e0? looking @ opcode list, seems 66 .. codes multi-byte expansions. feel better answer here unless tried grok opcode list few hours. that asm output following (insane) code in c, optimizes down simple infinite loop: long = 0; main() { recurse(); } recurse() { i++; recurse(); } when compiled gcc -o2 , compiler recognizes infinite recursion , turns infinite loop; well, in fact, loops in main() without calling recurse() function. editor's note: padding functions nops isn't specific infinite loops. here's set of functions range of lengths of...

struts2 - Download file pfrom portal using JSR 286, Struts 2.2.0 + PortletPlugin 2.2.0 on IBM WP 6.1.5 -

i'm using jsr-286 + struts 2.2.0 + portletplugin 2.2.0 i can't set name file user wants download. user can file, it's name corrupted. instead of "myimage.png" user gets "241883e9" or "241563a2". if users renames downloaded file , opens can see file not corrupted. please, see code: file-listing.jsp: <li onclick="gotoaction('<s:url action="downloadattachement" portleturltype="resource" />', {'attachementid':<s:property value="id" />}, 'post')"><s:property value="name"/></li> function "gotoaction" dynamically generates , submits (i've tried both: post , get, doesn't help.): <form action="/wps/myportal/!very_long_portal_url_goes_here/" method="post" id="actionurltemporaryform1295987206509"> <input type="hidden" name="attachementid" value="2" /...

Jquery change Contenteditable attr IE -

i have following short code create div when button clicked, inside div span tag contenteditable="false". when span doubled clicked, should set , change contenteditable attribute false true, text can made editable on dblclick. check example @ http://jsfiddle.net/dtxhe/ this working in firefox, chrome , ie8, not ie7 or quirks mode. ideas. how can fix this. in case hadn't figured 1 out answer believe difference between "contenteditable" , "contenteditable" attribute name. ie7 picky.

php - Milliseconds conversion to basic time -

i need convert 1774132 30:42 or 30 minutes , 42 seconds or whatever output of is. there php function this? i found online long time ago, have no idea anymore: <?php function secondstowords($seconds) { /*** return value ***/ $ret = ""; /*** hours ***/ $hours = intval(intval($seconds) / 3600); if($hours > 0) { $ret .= "$hours hours "; } /*** minutes ***/ $minutes = bcmod((intval($seconds) / 60),60); if($hours > 0 || $minutes > 0) { $ret .= "$minutes minutes "; } /*** seconds ***/ $seconds = bcmod(intval($seconds),60); $ret .= "$seconds seconds"; return $ret; } echo secondstowords(time()); ?>

jquery DataTables plugin: can you capture server-side data other than the JSON expected by the plugin? -

i'm using "bserverside": true, "sajaxsource":, , "fnserverdata":... populate datatable. working fine. "bfilter": true, "bsort": true, "bsortclasses": true, "bprocessing": true, "bserverside": true, "sajaxsource": "my_page_that_outputs_json.asp", "fnserverdata": function ( ssource, aodata, fncallback ) { aodata.push( { "name": "my_custom_var" , "value": $('#somecustomvar').val() } ); $.getjson( ssource, aodata, function (json) { fncallback(json); } ); }, however, when make call server, want return more json page connecting server. have additional recordsets i'd return 1 call database, possible within datatables framework? page outputting json, when retrieved datatable, expecting json, , gives error when other elements present. update 1: don't know if proper route take, i...

oop - How can one implement OO in Lua? -

lua not have build in support oo, allows build yourself. please share of ways 1 can implement oo? please write 1 example per answer. if have more examples, post answer. i think of oop being encapsulation of data inside container (the object) coupled subset of operations can done data. there lot more it, let's assume simple definition , build in lua (also familiarity other oo implementations can nice boost reader). as little exposure lua may know, tables neat way store key-value pairs , in combination strings, things start become interesting: local obj = {} -- new table obj["name"] = "john" obj["age"] = 20 -- there's shortcut! print("a person: " .. obj.name .. " of age " .. obj.age) string values keys in table can accessed in way alike members of struct in c or public members of object in c++/java , similar languages. and cool magic trick: let's combine anonymous functions. -- assume obj last exampl...

ecmascript 5 - Does JavaScript (ECMAScript5) Strict Mode offer significant performance advantages to merit widespread use? -

i'm reading bit on using strict mode javascript , seems that, speaking, idea force more rigid set of rules onto coder ensure js engine can optimise code better. feels javascript equivalent of "option explicit" in visual basic. if net effect of applying strict mode code, performance difference such worth applying out of habit rather case-by-case? there other advantages besides code stability might worth considering? what of key reasons want apply strict mode scripts? well, strict mode code can perform better because removes issues made optimization harder, example, top of head: the with statement removed (really difficult -if not impossible- optimize). no more undeclared assignments, , other prohibitions, e.g. ( delete varname; ) eval not introduce variable/function declarations local scope. arguments.callee removed, (difficult optimize (e.g. function inlining )) the arguments object index named properties not anymore dynamically mapped named ...

json - How to prevent cancellation of ajax request upon redirect? -

this first ajax request. don't want client browser wait, code not waiting success. redirects page immediately. it's not working. $.ajax({ data: '{}', url: "service.asmx/getnextid", success: function(msg1) { $.ajax({ type: "post", cache: false, contenttype: "application/json; charset=utf-8", datatype: "json", timeout: 5000, url: "service.asmx/savedata", datafilter: function(data) {var msg = (typeof (json) !== 'undefined' && typeof (json.parse) === 'function') ? json.parse(data) : eval('(' + data + ')');return (msg.hasownproperty('d')) ? msg.d : msg;}, data: "{id:'" + $get('<%=txt1.clientid %>').value + "',date:'<%=cutoffdate%>',data:'" + $("#<%=txt2.clientid %>")....

language agnostic - Service needed to get a customer's browser and OS information -

i know there service can send private link customer , browser , os information via email solve bugs , support issues. apparently service's google page rank below zero, not find it… does know name? i stumbled upon new service solves problem , more: http://jooplicate.com

php - Login automatic using session_start(); and detect network -

hey i'm thinking 3 days of solution login scipt login people specific network automaticly. can't figure out :) this part of index script use people can login manually <?php session_start(); if (session_is_registered("example")) { require('./log_header.php'); } else { header( 'location: pre.php' ) ; } ?> but want users connected through specific network [10.92.80.1] don't have login :) plz :) thanks! solution firts of fast responses! :) it's working now. here's code used, :) if (session_is_registered("example")) { require('./header.php'); require('scripts/members.php'); } elseif (strripos(gethostbyaddr($_server['remote_addr']), ".kulnet.kuleuven.be")) { require('./header.php'); require('scripts/members.php'); } else { header( 'location: login.php' ) ; } ?> thanks again! :) knowing server not located within...

c++ - QNetworkAccessManager finished signal is not emitted when compiled in release mode (VS 2005) -

i have class reads web pages. works expected when built in debug mode in visual studio, doesn't work when built in release mode. basically, qnetworkaccessmanager 's finished signal never gets emitted. i have code stripped bare working minimum , still doesn't work. have tried use qtnetworkd4.lib in release mode (the same library in debug mode) , disable optimization, no effect. qt version 4.4 edit here sample code. header: #include <qnetworkaccessmanager> #include <qnetworkreply> #include <qnetworkrequest> #include <qstringlist> class webreader : public qobject{ q_object public: qstringlist *pagedata_; webreader(); ~webreader(); void fetch(const qstring &url); public slots: void slotreplyfinished(qnetworkreply *reply); protected: qnetworkaccessmanager *netmanager_; private: qnetworkreply *netreply_; }; cpp: webreader::webreader(){ netmanager_ = new qnetworkaccessmanager(this); pag...

Remove Etags from Amazon S3 files? -

is idea remove etags amazon s3 files. normal regular files stepping cdn world. not sure if need these keep them updated or what? you cannot remove etags on s3 files. amazon creates these automatically uploaded files , cannot changed or removed.

How can I reliably evaluate the performance of pitch tracking algorithms on an Android device? -

ok, realise question vague supply context, , perhaps receive context related answers. i conducting final year project part of bsc computer science maths degree, , chosen project evaluate pitch tracking algorithms running on mobile device. there few standard algorithms implement on android based device. i evaluate frequency estimators on performance, reliability , accuracy, required produce quantitative measures relate to. my concern conclusions going heavily related own implementation of these algorithms. how go detecting or minimising inefficiencies i've introduced? furthermore, there performance issues related mathematical calculations on mobile devices in general should aware of? read integer arithmetic favoured because floating point values aren't supported processor? i read of related questions , point towards books standard algorithms, it's not easy when number of pitch tracking algorithms exist description in academic paper. i directed towards perform...

php - GMP Bit shift doesn't work on negative numbers -

i found function @ php.net. seems work on positive numbers, fails on negative ones: function gmp_shiftr($x,$n) { // shift right return(gmp_div($x,gmp_pow(2,$n))); } echo -1 >> 8; //returns -1, presumably correctly echo "<br />"; echo gmp_strval(gmp_shiftr(-1,8)); //returns 0, presumably incorrectly how fix function work negatives? two ideas have: maybe along lines of if (whatever) { $a >> $b} else{ gmp_shiftr($a, $b) }? or, maybe subtract negative results depending on value..? i want value >> give, >32bit numbers when use gmp. looking @ gmp documentation division routines , there's function void mpz_tdiv_q_2exp (mpz_t q, mpz_t n, unsigned long int b) that seems might want: arithmetic right shift treats n if represented in twos-complement, , (i think) shifts b places right. unfortunately, level of api doesn't seem exposed php gmp. i found bit twiddling hack doing sign extension when number of bits in ...

c++ - How to serialize a CString using boost -

i'm trying use boost::serialization replace 1 part of existing project implements own methods serialization not good. however, i'm facing problems because application uses mfc. tried serialize cstring follows template<class archive> void save(archive & ar, cstring & s, const unsigned int version) { using boost::serialization::make_nvp; const std::basic_string<tchar> ss((lpctstr)s); ar & make_nvp("string", ss); } template<class archive> void load(archive & ar, cstring & s, const unsigned int version) { using boost::serialization::make_nvp; std::string ss; ar & make_nvp("string",ss); s = ss.c_str; } but i'm getting errors boost_1_45_0\boost\serialization\access.hpp(118): error c2039: 'serialize' : not member of 'atl::cstringt' in access.hpp says // note: if compile time error here // message like: // cannot convert parameter 1 <file type 1> <file t...

html - Crazy div structure CSS - help please -

i'm trying layout (see image: http://www.pricedesignstudio.com/download/divs.png ) , having issue...i bottom, 100% width (footerbottom) footer expand upward to fill vertical space between bottom content block (containera) , bottom of page. have similar working using absolute positioning , z-index of additional footer, don't think it's optimal. anyway, easier show code explain think. please let me know if have input. in advance! html, body { text-align: center; margin: 0; padding: 0 0 0 0; height: 100%; left: 0; top: 0; right: 0; bottom: 0; background: #fff url(images/bkgrnd_main.png) repeat-y center top; } .container { width: 970px; min-height: 95%; position: relative; border: none; text-align: center; margin: 0 auto 0 auto; padding: 0 0 0 0; position:relative; } .containera { display:block; min-height: 300px; position: relative; border: none; text-align: left; margin: 0 0 ...