Posts

Showing posts from May, 2012

Google App. Engine - Hosting our Web Application -

all, we trying host our web application on google app. engine little success. here specifics: web application built on html5, svg & javascript. using python 2.6 upload. used following tutorial upload getting errors once uploaded. link tutorial: http://www.labnol.org/internet/host-website-on-google-app-engine/18801/ we getting errors in appcfg.py python file. totally clueless how go using guidance awesome, tutorials more so. update: further outcry , milimetric's helpful post, here more detail: we have managed upload web application onto google app engine. going dashboard, can see application running (we can see instance graphs , cpu stats), however, when execute custom link web application, 'hello world' message. we followed tutorial milimetric & rolled 'appcfg.py' original state. following tutorial, made changes 'app.yaml' (inserted our application name). didnt write custom python script. we not getting errors anywhere, message...

c# - FormClosing delegate event problem -

i have 2 forms named 'mainform' , 'addrslt'. idea when users click on button in mainform, addrslt form show() , user populate treeview. when user want close addrslt form, program instead hide() form (using e.cancel = true; ) later if user reopen he/she can add more things treeview. in mainform have button showing addrslt form, , inside button's click code, there formclosing delegte detect , copy contents od treeview in addrslt form treeview in mainform. now problem want check duplicated nodes , not add them treeview in mainform. done right, have message box tells user program had not added existing nodes! thats ok till now.. but problem each time this, messagebox appear n+1 times! mean if first time, message box appears 2 time , etc... here code! sorry long story! private void menufileaddtestresults_click(object sender, eventargs e) { addrslt.show(); addrslt.formclosing += delegate { foreach (treenode node...

c# - Set directory permissions on Windows XP -

when right-click on file or directory in windows xp , select 'properties' usual windows properties pop-up. in pop-up there 2 places can set file permissions, first, in 'security' tab, has checkboxes 'full control', 'modify', 'read & execute' etc. , second can found clicking 'advvanced' button @ bottom of 'security' tab. i know how set file/directory permissions 'advanced' section programmatically in c# (using .getaccesscontrol, .addaccessrule , .setaccesscontrol), cannot find way of programmatically setting file permissions in normal 'security' section of file properties window. can tell me how programmatically in c#? these different views of same underlying data - need use methods mention update file permissions. information available here: http://msdn.microsoft.com/en-us/library/system.io.file.setaccesscontrol.aspx

How to show documentation in Clojure -

i following : (defn ss [] "kjhhj") (doc ss) but "nil" returned. why this? update: if : (defn tt "kjhhj" [] 1) (str (doc tt) ) as shown empty string... "doc" output go out or something? the docstring comes before arguments function. have defined function no docstring returns string. user> (defn ss [] "kjhhj") #'user/ss user> (ss) "kjhhj" user> (doc ss) ------------------------- user/ss ([]) nil nil user> (defn tt "kjhhj" []) #'user/tt user> (tt) nil user> (doc tt) ------------------------- user/tt ([]) kjhhj nil user>

c# - Datagridview similar to SQL Server Table designer with combo box and datetime picker -

Image
from long time i've been struck datagridview in c#.net. need customized datagrid view combo boxes, text boxes , date time picker controls validate on row-leave , cell-leave events. i'm attracted datagrid of sql server data entry. manytimes tried didn't succeed. please suggest me if know any. if using winforms can add combobox columntype [for further reference] http://msdn.microsoft.com/en-us/library/bxt3k60s.aspx msdn for datetimepicker see example image showing how customise datagridcolumntype uploaded below

osx - trying to write a paper on mac os x and win xp system scheduling cant find info -

im trying write paper on mac os 10 , windows xp system scheduling cant find information on web can suggest websites ?? this might mac mac osx internals

html - How does one get the width of an absolute/fixed element with jquery/js, on resize? -

lets have fixed or absolute positioned element: <div> fixed div. </div> with following css: div:first-of-type { background-color: red; position: fixed; top: 20px; left: 20px; right: 20px; bottom: 20px; } you can figure out width via: $(function() { $(window).resize(function() { var $myfixeddiv = $('div:first'); console.log($myfixeddiv.width()); //$myfixeddiv.innerwidth(), $myfixeddiv.outerwidth() }); }); however, when resize window, width reported both firefox , chrome 0. how 1 figure out true width is? you take window's width , minus 40 both axis. var width = $(window).width()-40; var height = $(window).height()-40; then rather using css top, left, bottom , right set width think unreliable in long term set div's width js var mydiv = $('#mydiv'); mydiv.width = width; mydiv.height = height;

objective c - Obj C - resign first responder on touch UIView -

i'm trying keyboard disappear when screen touched, question answered on stackoverflow. able keyboard disappear when enter key pressed thread here. i'm not having luck on background touch resigning first responder. method being entered, have nslog in method saying, "in backgroundtouched" keyboard still there. i've tried making uiview uicontrol class use touch event. journalcomment uitextview. -(ibaction)backgroundtouched:(id)sender { [journalcomment resignfirstresponder]; nslog(@ "in backgroundtouched"); } i've tried having invisible button under calles backgroundtouched method. think maybe i'm missing in interface builder, i'm not sure what. thank help! this works done button: -(bool)textview:(uitextview *)textview shouldchangetextinrange:(nsrange)range replacementtext:(nsstring *)text { // new character added passed in "text" parameter if ([text isequaltostring:@"\n"]) {...

objective c - UI View too big -

i created project make iphone application. follow instruction on ' http://developer.apple.com/library/ios/#documentation/iphone/conceptual/iphone101/articles/05_configuringview.html well make first uiviewcontroller got seems ui view controller ipad its big i want create things iphone. not ipad. so do? when creating new uiviewcontroller uncheck "target ipad" radio button option.

flash - How to create a custom property/method inside a MovieClip? (AS3) -

i'm programming kind of "lights off" game in flash professional (not flash/flex builder) , nice if manage on/off state in grphically designed symbol this: square1.on(); /* calling method produces same */ square1.on = true; square1.gotoandstop("onstate"); /* obviously, next method: */ square1.off(); /* produce */ square1.on = false; square1.gotoandstop("offstate"); is possible? how create custom on property , custom methods on() , off() ? if not possible, else can do? thank you. use property state , create 2 functions change state , navigate playhead. also, should extending movieclip create these custom properties... better practice. class mysquare extends movieclip { public function on ():void { this.state = 'on'; this.gotoandstop('onstate'); } public function off ():void { // same, off } [tutorial] export actionscript

c++ - Using a class function in int main() -

i having problems calling functions main program. these functions have in class. how access them int main()? #include <iostream> #include <stdio.h> #include <pthread.h> #include <stdlib.h> #include <math.h> #include <sys/types.h> #include <semaphore.h> #include <synch.h> using namespace std; class mycountingsemaphoreusingbinarysemaphore { public: void waitsemaphore(pthread_mutex_t *thread) { pthread_mutex_lock(*thread);// makes value 1 (not available) } void signalsemaphore(pthread_mutex_t *thread) { pthread_mutex_unlock(*thread); // makes value 0 (available) } void deletesemaphore(pthread_mutex_t *thread) { pthread_mutex_destroy(*thread);// deletes } }; int readercount; int database = (rand() / 100); // number less 1000 void reader_writer(void); int main(int argc, char *argv[]) { mycountingsemaphoreusingbinarysemapho...

actionscript 3 - Set dimensions of a loaded image in Flash -

how set width , height of loaded image in flash? setting dimensions after requesting not work. width , height remain zero. var poster:loader = new loader(); stage.addchild(poster); poster.load(new urlrequest('http://example.com/image.jpg')); poster.width = 320; poster.height = 240; trace(poster.width); // 0 trace(poster.height); // 0 if wait short moment , set dimensions, work. i tried listening event.init event , event.complete events before resizing suggested tutorials. neither of events triggered. public function theclass() { this.poster = new loader(); this.poster.contentloaderinfo.addeventlistener(event.init, this.imageloaded); this.poster.contentloaderinfo.addeventlistener(event.complete, this.imageloaded); stage.addchild(this.poster); this.poster.load(new urlrequest('http://example.com/image.jpg')); } private function imageloaded(event:event):void { trace('image loaded'); this.poster.width = 320; this.poster...

jquery - List Divider for Collapsible Content? Possible? -

is there way have content divider collapsible content, not list, in jquery mobile? you can put inside collapsible block, can grid proportions or listview. if want divider on clickable part of collapsible, you'll have hack css

c# - Managing a Network failure during a Transactional SqlBulkCopy -

i'm researching sqlclient's sqlbulkcopy in ado.net , have following questions. what happen, if there network error during sqlbulkcopy operation, running under part of transaction on huge number of records? will transaction left open (neither committed, nor rolled back) in server, until manually kill it? what best approach sending large number of records in 2 datatables (invoiceheader, invoicedetails) in dataset respective sql server tables(invoiceheader, invoicedetails)? thank you. edit: a few details wanted add, forgot: this .net v3.5; i'm using enterprise library database interactions. assuming using transactionscope, m y understanding no , transaction not left open, because sql server detect ambient transaction , auto enlist. means worst case transaction times out, rolling back. can change transaction binding specify in event of timeout (you want explicit unbind).

Why does Android allow an APK with an expired certificate to be installed? -

i made apk signed certificate has validity of 1 day. aim give trial app people, preventing them copying application after expiration date. if copy application before expiration date okay. thought android os block application expired certificate being installed on phone. however, find can install application on phone 2 days after expiration of certificate signed. jarsigner confirms certificate has expired. why android allow application installed expired certificate? i understand allowed installed developer via adb or thirty-party . sure if upload market you'll find difficulties. imho, logical because when install applications out of market assuming many risks couldn't solve right-signed application.

android - Problem Nexus 1 running apps on my phone from Eclipse -

i have samsung google nexus s. great phone. i have been developing apps on it, not of problem. since last week can not run apps eclipse on phone anymore. following error: [2011-04-11 20:12:48 - imagebrowser] android launch! [2011-04-11 20:12:48 - imagebrowser] adb running normally. [2011-04-11 20:12:48 - imagebrowser] performing com.xxx.android.imagebrowser.imagebrowser activity launch [2011-04-11 20:12:48 - imagebrowser] automatic target mode: using device '34315b519d6000ec' [2011-04-11 20:12:48 - imagebrowser] uploading imagebrowser.apk onto device '34315b519d6000ec' [2011-04-11 20:12:48 - imagebrowser] failed install imagebrowser.apk on device '34315b519d6000ec': established connection aborted software in host machine [2011-04-11 20:12:48 - imagebrowser] java.io.ioexception: established connection aborted software in host machine [2011-04-11 20:12:48 - imagebrowser] launch canceled! i going out of mind. has been working before. have tried running ...

c++ - export specialized template function from a dll -

i have template function define in header file in dll. don't need export function because of consumers read in header file , have whole function anyway. however, have specialization of template can't defined in header file (or redefinition linker errors), has go in source file. what normal way export function? template <typename t> bool functionname(/*params*/){ //..... } template<> importexportmacro bool functionname(/*params*/); and source file has template<> bool functionname(/*params*/){ //... importexportmacro 1 of macros either __declspec(dllimport) or dllexport thanks template things indeed place holders. until use , compiler not replace real (function / class) thing. can't place in dll. way provide in header file. if want hide implementation, consider using class hierarchy (runtime polymorphism)

windows mobile - Capture Left/Right Soft Key press -- C# .net CF 3.5 -

my application running on handheld device running windows mobile 6.5. want able capture left/right soft key button presses within application , take user "home" form or form used inside application. @ os level, these soft keys set go calendar/contacts respectively, inside application these buttons mentioned above. how go capturing or intercepting these soft key button presses inside of compact framework? have done little research , have seen references registering hot key? appreciated. side note: application uses mainmenu control left/right soft keys not control menu selections. try this: public class hbuttons : system.windows.forms.form { private mainmenu mainmenu1; private menuitem mnuback; mymessagewindow messagewindow; public hbuttons() { initializecomponent(); this.messagewindow = new mymessagewindow(this); registerhkeys.registerrecordkey(this.messagewindow.hwnd); } protected override void dispose(bo...

json - Create object hierarchy from Make output? -

make -d , make -p provide useful information, need in json format, can enumerate libraries came source files, recursively. there way (approximately close, anyhow)? or there custom tool available? i've scoured intarwebs, , search has come dry. thank help! note: i'm looking that's similar sysconfig.parse_makefile. in fact, pretty close i'm looking for, except it's useful implicit makefile used build python. pointers? it's not json, perl cpan module makefile::graphviz creates visualizations of dependency graph makefile. if json want, capture 'dot' dependency file generated , convert json easily.

design patterns - C++ where I'll need local extension or foreign method? -

i'm not familiar c++ enough know 2 similar refactorings (introduce local extension , introduce foreign method) needed. know cases forces use those, can't figure sample classes need "trick". i'm making c++ refactoring tutorial, new developers, looks need yours :) if used it, please tell me in , why. in advance. "foreign" methods methods operate on, aren't members of class. in java, means (static) methods of other classes take first class argument. in c++, you'll need aware of free functions. unlike java , in c++ methods can exist outside classes. int main() famous one. stl packed free functions. have peek in alone. for java, site linked advises "foreign methods work-around" , suggest "introduce local extension" alternative refactoring. in c++, free functions not work-around. means there's less pressure introduce local extensions. furthermore, in c++ functions not virtual default, , objects passed val...

vb.net - How to set <ItemTemplate> to a datasource? -

how can set datasource of itemtemplate? right have 1 wrapped datarepeater , how databind it. <asp:repeater id="rpttotal" runat="server"> <itemtemplate> <tr> <td>one</td> <td>two</td> <td>three</td> <td>four</td> </tr> </itemtemplate> </asp:repeater> you cant set datasource item template, can set repeater in code behind using rpttotal.datasource = datasourcename

java - setSerializationId no such method error -

im trying run project, error hits me everytime: org.springframework.web.context.contextloaderlistener java.lang.nosuchmethoderror: org.springframework.beans.factory.support.defaultlistablebeanfactory.setserializationid(ljava/lang/string;)v @ org.springframework.context.support.abstractrefreshableapplicationcontext.refreshbeanfactory(abstractrefreshableapplicationcontext.java:128) @ org.springframework.context.support.abstractapplicationcontext.obtainfreshbeanfactory(abstractapplicationcontext.java:467) @ org.springframework.context.support.abstractapplicationcontext.refresh(abstractapplicationcontext.java:397) @ org.springframework.web.context.contextloader.createwebapplicationcontext(contextloader.java:276) this spring application context: http://sharetext.org/2e7 what can cause this? appreciated. thanks in advance. the setserializationid method present in defaultlistablebeanfactory class spring 3.0 not in same class spring 2.5. think you...

android - SharedPreferences, PreferenceActivity problem -

i have in settings.xml 2 checkboxes. each checkboxes has same keys "showcontactphotoscheckboxpref": <preferencescreen android:title="appearence" android:key="appearencepref" > ...... <preferencecategory android:title="show contact photos"> <checkboxpreference android:title="show contact photos" android:summary="@string/show_contact_photos_preference" android:defaultvalue="true" android:key="showcontactphotoscheckboxpref" /> </preferencecategory> ........ </preferencescreen> ....... <preferencescreen android:title="contact options" android:key="contactotionspref"> <preferencecategory android:title="show con...

c# - How to handle pivoting POCOs? -

i have poco based off normalized table. question how handle changing not pivoted/normalized object de-normalized/pivoted object? need create poco pivoted version? how 1 handle this? let's pretend normalized poco defined as: customer table customerid int bestseller bool numberoforders int and want represent as pivot customer table customerid int bestsellerorders int notbestsellerorders int update this works, not sure it: public void updatecustomer(customerpivot customerpivot) { using (var context = dataobjectfactory.createcontext()) { // find rows update (2) var rowstoupdate = context.customer .where(w => w.customerid == customerpivot.customerid).tolist(); var first = rowstoupdate.where(w => w.bestseller == true).singleordefault(); var second = rowstoupdate.where(w => w.bestseller == false).singleordefault(); first.numberoforders = (int)customerpivot.bestsellerorders; second.numbe...

Facebook API Authentication in Coldfusion without login box -

i have been looking information on how authenticate facebook api without login button , haven't been able find anything. want pull data static user (i don't want pull information every person visits page specifically, want pull information specific user account). i want convert feed retrieve rss feed, or atom feed client display in website. is there information how authenticate in way? an example of info want pull pull wall posts facebook account , display them feed. no matter do, login button or not, have have user authenticate application in order retrieve sort of data. the easiest way use either facebook login button or use javascript sdk , this... fb.login(function(response) { if (response.session) { if (response.perms) { // user logged in , granted permissions. // perms comma separated list of granted permissions } else { // user logged in, did not grant permissions } } else { // user not logged in } }, {pe...

php - CakePHP session ID path or other method to share the results of a url - recommendations welcome -

i looking suggestions on sensible cake approach creating session id based url can share others see same search results seeing on end. i know in standard php, session id , pass url. guess cake has method or approach exact thing (my guess). have not been able locate specific yet. any ideas best approach cake methods? or need re-invent wheel on this? are asking because using post , consequentially url not include search parameters, through get? i use following design paradigm search on apps build. search form submits post. in controller action, if form submitted post, extract search parameters, , redirect url includes (named*) parameters. so action code might this: function search() { if($this->requesthandler->ispost()) { // let's extract parameters called $a , $b here $this->redirect(array( 'action' => 'search', 'a' => $a, 'b' => $b ) e...

html - Blank bar at the bottom of a page -

i've been working on few sites, , reason, blank bar keeps showing @ bottom. i've tried inspecting elements, , nothing makes sense. html , body elements set margin: 0 , padding: 0. any ideas on how remove blank bar @ bottom? thank you! remove &nbsp; clearfixing divs. height:0 , space character taking space. 1 remove it, div collapse properly.

retrieve mysql output from django 'manage.py sql appname' -

i wondering if there way retrieve mysql code db setup. right it's using sqlite output when run 'manage.py sql management' see below: mb-pr0:users jg$ python manage.py sql management begin; create table "management_service" ( "id" integer not null primary key, "service_name" varchar(32) not null ) ; create table "management_employee_services" ( "id" integer not null primary key, "employee_id" integer not null, "service_id" integer not null references "management_service" ("id"), unique ("employee_id", "service_id") ) ; create table "management_employee" ( "id" integer not null primary key, "first_name" varchar(32) not null, "last_name" varchar(32) not null, "email" varchar(32) not null, "gmail_active" bool not null, "employee_status" bool not ...

c# - Why does GC put objects in finalization queue? -

as understand, garbage collector in c# put objects of class finalization queue, implement destructor of class. when reading documentation gc.suppresfinalize, mentions object header has bit set calling finalize. i wondering why implementers of gc had put objects in queue, , delay freeup of memory 1-2 cycles. not @ bit flag while releasing memory, call finalize of object , release memory? no doubt idiot , not able understand working of gc. posing question improve understanding or fill missing gap in knowledge edit : if bit flag suppressfinalize, gc implementers have added flag in object header purpose, no? so can run in different thread , keep blocking main gc thread. you can learn lot gc msdn article .

Java thread program works in Eclipse, but not in terminal / command prompt -

this code runs fine within eclipse, not in command prompt (or terminal). appreciated, have no idea why it's not working. runs way through in eclipse, hangs during execution in command prompt. the producer class generates random doubles , calls add(), while consumer class calls pop(); both call these 1,000,000 times. buffer.java public class buffer{ private double[] buf; private int next = 0; private int start = 0; private int semaphore = 1; private boolean isfull = false; private boolean isempty = true; public static void main(string[] args) { buffer pcbuf = new buffer(1000); thread prod = new thread (new producer(pcbuf)); thread cons = new thread (new consumer(pcbuf)); prod.start(); cons.start(); } public buffer(int size){ buf = new double[size]; } private synchronized void bwait(){ while(semaphore <= 0){} semaphore--; } private void bnotify(){ semaphore++; } public void add(double toadd){ boolean hasadded = false; whi...

xml - How can I have the user set the amount of time they want on a timer app in android? -

beginner here question. i'm trying build timer app friend, , aware of hander.postdelayed set timer specified amount of time. wondering if there way let user decided how time want countdown from, , if so, let them choose through xml. appreciate , hope clear enough question. you can use timertask , timer , pass in amount of time xml file.

data structures - Using Pointer to Functions Inside Structs in C -

just s & g. wanted build own library in c. wanted make follow c# object notion , realized way have base types use pointers functions members. well, stuck , have no clue why. following sample of string base type may like: #ifndef string_h #define string_h typedef struct _string { char* value; int length; string* (*trim)(string*, char); } string; string* string_allocate(char* s); string* trim(string* s, char trimcharacter); #endif /* string_h */ and implementation: string* trim(string* s, char trimcharacter) { int i=0; for(i=0; i<s->length; i++) { if( s->value[i] == trimcharacter ) { char* newvalue = (char *)malloc(sizeof(char) * (s->length - 1)); int j=1; for(j=1; j<s->length; j++) { newvalue[j] = s->value[j]; } s->value = newvalue; } else { break; } } s->leng...

erlang - error_logger "deadlock" problem -

i added event handler redirect error_logger reports syslog. handler looks this: handle_event({info_msg, _gleader, {_pid, format, data}}, #state{info_logger=logger}=state) -> syslog_write("i", logger, format, data), {ok, state}; handle_event({error, _gleader, {_pid, format, data}}, #state{error_logger=logger}=state) -> syslog_write("e", logger, format, data), {ok, state}; handle_event(_event, state) -> {ok, state}. syslog_write(prefix, facility, format, data) -> cmd = try message = lists:flatten(io_lib:format(format, data)), lists:flatten(io_lib:format("logger -t essmsd -p ~s.debug \'<~s> ~s\'", [facility, prefix, message])) catch _:_ -> lists:flatten(io_lib:format("logger -t essmsd -p ~s.debug \'~p\'", [facility, [prefix,...

Using jQuery to set the CSS of an element using one of that elements own CSS properties? -

i trying add standard style javascript scripted hyperlinks in webapps. replacing standard solid line dotted line. can achieved css there major drawback that, border color doesn't match link color. figured since links using js anyways, why not js. here i'm trying in jquery. $(function(){ $('a.scripted').css({ 'text-decoration': 'none', 'border-bottom': '1px dotted', 'border-color': $(this).css('color'), }); }); however, doesn't work. $(this) doesn't refer selected element , makes sense. question is, how can this? tried wrapping this: $(function(){ $('a.scripted').ready(function(){ $(this).css({ 'text-decoration': 'none', 'border-bottom': '1px dotted', 'border-color': $(this).css('color'), }); }); }); this did not work. advice? edit this code works not visited links. ...

javascript - Store value in URL with keeping the original values in browser -

so i'm creating asp.net page using javascript calculate distance between 2 zipcodes. after submitting form, page shows both addresses , distance. however, want use these values in asp.net stored distance in url can call .net label when so, , since has go server, refreshes page , deletes javascript calculated values! want store distance in url in addition keep calculated values on page. here have var geocoder, location1, location2; function initialize() { geocoder = new gclientgeocoder(); } function showlocation() { geocoder.getlocations(document.forms[0].address1.value, function (response) { if (!response || response.status.code != 200) { alert("sorry, unable geocode first address"); } else { location1 = {lat: response.placemark[0].point.coordinates[1], lon: response.placemark[0].point.coordinates[0], address: response.placemark[0].address}; geocoder.getlocations(document.form...

HTML5 for marking up functionality - what semantic tags should I use? -

when comes writing blog markup, absolutely understand use of article , section tags. masthead sections have 2 widgets. 1 has search engine embedded , other marketing copy leading faq page. what correct html5 markup in case? how mark widget functionality? my masthead sections have 2 widgets. 1 has search engine embedded... a search engine embedded? mean search field , i.e. text field can type search terms? that, want <input type="search"> . ...and other marketing copy leading faq page. does qualify “widget”? if it’s marketing copy “leading” faq page, sounds link me, has been semantically represented in html since version 1 <a> element. html pretty simple, don’t want over-think it. don’t need specific tags people possibly give name to. (what “widget”? isn’t section of page?) things, <section> fine .

wolfram mathematica - Adding the last two elements of a list -

in mathematica, cleanest way of taking list {r1, r2, r3, ..., rn, a, b} and returning {r1, r2, r3, ..., rn, + b} or more {r1, r2, r3, ..., rn, f[a, b]} for function f ? lst = {a[1], a[2], a[3], a[4], a[5], a[6], a[7], a, b}; lst /. {a___, b_, c_} -> {a, f[b, c]} ==> {a[1], a[2], a[3], a[4], a[5], a[6], a[7], f[a, b]} or (ugly): append[take[lst, {1, -3}], f @@ lst[[{-2, -1}]]]

Executing unix shell commands using PHP -

a text box used capture command. i've been told have use exec() function execute unix shell commands. something this, user types ls in text box. exec() function execute unix command , command displayed on web page. what want know how output of shell command , display in web browser using php. i don't know start since i'm new php. i'm using ubuntu. you start looking @ php manual: system program execution but sdleihssirhc mentioned, watchout dangerous , should not allow executed! if still want it, output of shell, use exec output of shell passed in second parameter. e.g.: exec('ls -la', $outputarray); print_r($outputarray);

c++ - finding whether the body contains gzipped data -

i have program wherein searches reply curl request specific strings. gzipped data. there way find whether reply text or gzipped format? header contain gziipped,deflate header, not consistent. there way search string , find if gzipped? you try taking @ first 2 bytes of data. gzipped data, they should 0x1f, 0x8b . member header , trailer id1 (identification 1) id2 (identification 2) these have fixed values id1 = 31 (0x1f, \037), id2 = 139 (0x8b, \213), identify file being in gzip format.

What is the minimum number of bits needed to correct all 2 bit errors? -

i learned hamming codes , how use them correct 1 bit errors , detect 2 bit errors, how extend correcting 2 bits, , maybe more? what minimum number of bits needed correct 2 bit errors? i think figured out. n=number of data bits, k=number error correcting bits(eg parity hamming) in ecc scheme, have 2^(n+k) possible bit strings. for single bit error: you must find k such total number of possible bit strings larger possible number of strings @ 1 bit error given string. the total possible strings @ 1 bit error 2^n(n+k+1) 1 string no error, n+k strings 1 bit error 2^(n+k)>=(2^n)*(n+k+1) you have plugin values of k until find 1 satisfies above(or wish solve it) similarly 2 bit error, is 1 string no error, n+k strings 1 bit error, n+k choose 2 strings 2 bit error. 2^(n+k)>=(2^n)*(n+k+1 + (n+k choose 2))

Use Android style Attributes in own Layout -

i want use style, android build in style attribute, won't compile. i' missing kind of import? ?android:attr/listitemfirstlinestyle <textview android:id="@+id/text" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" android:layout_gravity="left|center_vertical" style="?android:attr/listitemfirstlinestyle" android:layout_marginleft="10dip"/>` thx did try remove question mark? style="android:attr/listitemfirstlinestyle"

Best UML designing tool in Linux? -

urgently want know best uml designing tool in linux? support erd possible use in netbeans ide 6.9.1 almost uml tools linux compliant. try papurus eclipse or bouml free , open source. rsa pretty omondo not free.

xamarin.ios - MKCoordinateRegionMakeWithDistance is unavailable on MonoTouch? -

i trying convert map example objective-c monotouch mkcoordinateregionmakewithdistance isn't wrapped in .net far managed find. this issue has been marked resolved monotouch team, it? :-) https://bugzilla.novell.com/show_bug.cgi?id=629743 it's there in monotouch 4. using monotouch.mapkit; ... var region = mkcoordinateregion.fromdistance(center, latmeters, lngmeters); hope helps.

Registering a ContentObserver in a Android Service -

i working on parental control/adult content filtering application. app continuously monitors calls , smses on child's mobile , logs activity onto server. starting service (myservice.java) on boot_completed , in oncreate method of service register contentobserver calllog , sms uri ( refer code snippet below ) . now issue is, since want monitor every outgoing, incoming call s , sms want service continuously running ( without being stopped/killed) . service being used registering content observers , not doing other processing(its onstartcommand method dummy ) , android os kills service after sometime. how ensure service runs continuously , keeps contentobserver object alive ? public class myservice extends service { private calllogobserver cllogobs = null; public void oncreate() { super.oncreate(); try{ cllogobs = new calllogobserver(this); this.getcontentresolver().registercontent...

xml - Namespace issue calling Axis2 web service from Flex4 with client generated by Flex Builder introspection -

i have java-based web service built axis2. wsdl generated eclipse 3.6 wizard. i have flex 4 client built using introspection via wsdl in flash builder 4. for calls method takes 'simple' type string or int, seems ok, calls parameter (on java side) , omelement, ie xml data, i'm setting following runtime error on service: org.apache.axis2.engine.axisengine - namespace mismatch require http://server.rsc.geo.othermaps.com found none http://server.rsc.geo.othermaps.com indeed target namespace declared in wsdl. the same workflow (use autogenerated client built web service introspection) worked fine against same service in flex 3, i'm not sure start hunting. need manually add namespace xml data i'm submitting? d if xml that's coming doesn't have namespace declaration @ top, add it.

PHP web-crawler -

i'm looking php web-crawler gather links large site , tell me if links broken. so far i've tried modifying example on here myself. my question code i've tried grabbing phpdig site down. suggestions great on how should proceed great. edit the problem isn't grabbing of links issue of scale i'm not sure if script modified sufficient enough grab possibly thousands of url's tried setting depth search link 4 , crawler timed out through browser. else mentioned killing processes not overload server, please elaborate on issue. not ready-to-use solution, simple html dom parser 1 of favourite dom parsers. let's use css selectors finding nodes on document, can find <a href=""> 's. these hyperlinks's can build own crawler , check if pages still available. you can find here .

compiler errors - Program not working as well - C -

the following code gives me 0 value 'count' time... #include <stdio.h> #include <stdlib.h> #include <string.h> #define size 128 int main () { char mychar , string [size]; int i; int count =0 ; printf ("please enter string: \n\n"); fgets (string, size, stdin); printf ("please enter char find: "); mychar = getchar(); (i=0 ; (string[i] == '\0') ; i++ ) if ( string[i] == mychar ) count++; printf ("the char %c appears %d times" ,mychar ,count); return 0; } thanks ! replace int const count = 0; with int count = 0; your trying change variable ( count++ ) declared const which, obviously, not allowed. edit: answer updated question should change loop condition string[i] == '\0' string[i] != '\0' . because loop runs while condition true. string[i] != '\0' true whole string except terminating null byte while...

.net - How to Show primary key data? -

i have 2 tables: transactions , accounts. transaction has foreign key idaccount accounts table. i assign datasource property of datasource property of datagridview transactions table. i want accounts.description insead of idaccount in datagridview. what must do? there solution problem offered here involves doing custom code inspect each property , determine if belongs main bound object or child object. this looks solution except doesn't support editing or sorting based on these properties. another approach (which recommend since simpler) introduce accountdescription property transaction object. public class transaction { private account _account public string accountdescription { { return _account.description; } set { _account.description = value; } } } you might need implement custom inotifypropertychanged code databinding works nicely.

Where to store html code for jQuery? -

in scripts long html blocks added selector. example $("#test").prepend($('<div id="tester">..long html tags..</div>').hide().fadein(2000)); where better store large html blocks? directly, in variable, in html code, text file or other. thank you. have had @ jquery templates ?

c# - When to register a method that will call Form.Invoke to an event? -

i following exception in windows form application system.invalidoperationexception: invoke or begininvoke cannot called on control until window handle has been created. the method exception occurs calls this.invoke (system.windows.forms.form.invoke). method registered event of class in constructor, seems lead race condition , exception. public form1() { initializecomponent(); someotherclass.instance.myevent += new somedelegate(mymethod); } private void mymethod() { this.invoke((methodinvoker)delegate { // ... code ... } } at stage of form lifecycle handle created? in event of form safe register method foreign event? i think if register method in onshow event should safe.

java - Is there a technology stack that makes connecting android applications easily? -

i'm creating android application. of functionality done offline, need build dependency between users of application, such being able see peoples "high scores" , communicate between users, , sending each other in-app messages. therefore, i'll need webserver app can connect in order store such information. imagine app make rest calls high scores. i'm trying avoid overhead of having create functional web application (springmvc example). there application makes simpler? what good, simple web stack use this? we use java restlet framework creating restful interfaces our mobile apps, , deploy via google appengine . shared series of screencasts on youtube demonstrating approach might find useful. restlet framework used in screencasts few versions old, should speed quickly. particular approach because it's straightforward android developers (who proficient in java), scales well, , free until hit google's quotas.

c# - how to allow login in with email using the asp signup component -

as title says how o allow users sign in using email specified when registered. using asp 3.5 , both login , signup ones built-in visual studio. also there way remove secret question , answer. thanks my simplest , effective workaround following: 1- rename label of username field e-mail : ( user see email, it's still username asp.net membership save). 2- save entry along side additional info need save 3- users forced login using provided email 4- smile :)

Flex: How to create an Image control from a flash.display.Bitmap? -

i need create image control bitmap because have itemredender use in list control. i'm trying show list of images (bitmaps) in list control , couldn't now. thanks in advanced. you can use bitmap image creating new image , setting source of image bitmap. can this: var _image:image = new image(); _image.source = yourbitmap;

java me - navigationClick() problem for more then one item on Blackberry -

i have listfield , objectchoicefield. in navigationclick method, how figure out 1 selected? in navigationclick() method: field field = getfieldwithfocus(); if (field instanceof listfield) // returns false if (field instanceof objectchoicefield) // returns false if (field == mylistfield) // returns false if (field == myobjectchoicefield) // returns false the navigationclick() method should fire object attached to, unlike fieldchangelistener can attached more 1 field, , changed field passed parameter. if want debug can use system.out.println(field.tostring()) , should give class name of being clicked. also, may want try using getleafwithfocus() in case getfieldwithfocus() returning manager of field has focus.

iphone - UIAction with two delete buttons -

i have actionsheets 2 delete buttons, "delete all" , "delete selected item". since delete destructive behavior, should keep them "destructive buttons" or can keep them normal buttons without destructive button @ all? advice me. thanks if make "delete all" destructive button. anger level falls down quick after have accidentally deleted 1 item. if whole dataset gone better stay away me. and there no need use destructive button @ all. can start destruction of whole world normal button. it might confuse users, it's okay so. "delete all" isn't destructive enough show red button. it's you.

How to Convince management to upgrade to .Net 4.0 -

we developed application using .net 2.0. license our software means whenever release new version, have push out change our existing clients. no 1 in group has slightest motivation upgrade newer version of .net. simple see more work our support team deploy , argue clients resistant change. can point me in direction of argument present non programmers might sway them. if noting else, argument safe, , not cause our clients harm have .net 2.0 framework on machines? i figure it's hopeless. i'm gonna stuck using .net 2.0 framework until 4 or 5 years bet... perhaps longer :( help! i want able use wcf, linq, wpf (possible), , option use entity framework 4.0.! thanks jonathan i tend agree @lior kogan, in upgrading sake of not should arguing management about. in fact, there arguments not upgrading: if you've got stable platform, why introduce potential instability? if upgrade this, force spend more money upgrading other things? will mean have force ...

ruby - Rails - How to do If and else statements in a text field -

i trying if , else statement in text field value: <%= f.text_field :rating, :size => 1, :min => 1, :max => 6, :value => if vind.ratings == 0 else vind.rating_score/vind.ratings, :type => 'range', :step => '1', :id => "#{vind.id}" %> i error in view: syntaxerror in kategoris#show showing c:/rails/konkurranceportalen/app/views/kategoris/_rating.html.erb line #3 raised: c:/rails/konkurranceportalen/app/views/kategoris/_rating.html.erb:3: syntax error, unexpected keyword_else, expecting keyword_then or ';' or '\n' ...ue => if vind.ratings == 0 else vind.rating_score/vind.ratin... ... ^ c:/rails/konkurranceportalen/app/views/kategoris/_rating.html.erb:3: syntax error, unexpected ',', expecting ')' ...vind.rating_score/vind.ratings, :type => 'range', :step => '... ... ^ i use shorthand, this: :value => ...

dll - RunTime Error 380 - Specified Fieldname not found in object -

i running vb6 application pervasive v9.5 database. receiving runtime error 380 - specified fieldname not found in object when 2 of users trying log in. rest of office fine...does have idea issue be? have searched few hours , can't find helpful. the login uses vaccess control during login. caused missing dll or ocx file on client machine? any suggestions appreciated out of ideas. edit: with valogon .refreshlocations = true .ddfpath = datapath .tablename = "userlog" .location = "userlog.mkd" .open if .status <> 0 errmsg = "error opening file " + .tablename + " - status " + str$(.status) + vbcrlf + "contact department" end if end i have enabled vadebug mode , on workstation in question, when app launched receive ddf error: the vaccess control unable open field.ddf @ specified ddfpath. may result error in ddfpath or refreshlocations properties, or corrupt field.ddf. then error...

How do you write a image to browser as a binary stream in coldfusion? -

i have service on coldfusion 9 server creates image banners on fly us. separate machine has save these files like: wget http://myserver.com/services/local/bannercreator/250x250-v3.cfm?prodid=3&percentsaving=19 the problem can't think of how coldfusion write out binary data without using temporary file. @ minute image displayed image tag this: <cfimage action = "writetobrowser" source="#banner#" width="#banner.width#" height="#banner.height#" /> any ideas? or should use temporary file? i can't test because you're not giving example code how images generated, have tried along line? <cfcontent reset="true" variable="#imagedata#" type="image/jpg" /> update: went ahead , created own image; i'll assume you're doing similar. works me: <cfset img = imagenew("",200,200,"rgb","red") /> <cfcontent variable="#tobinary(tob...

caching - Enum vs cache? Which one is better -

i found out co_workers using enum lot. , using enum kind of data store lists, status list, role list, etc.. , not sure if way deal kind of data. put data db , read them cache instead of putting data code itself. the decision of enum vs. database table depends on whether expect additional values added/removed while system in production. for example: use enum for: payment method (cash, check or credit card) billing frequency (daily, weekly, monthly, quarterly) gender status use database table for: carrier delivery (fedex, ups, ???) product category (books, music, games, ???) airline

javascript - focus filtering select on page load -

why following code don't focus filteringselect? <!doctype html> <html> <head> <script type="text/javascript" src="http://yandex.st/dojo/1.6.0/dojo/dojo.xd.js" djconfig="parseonload: true"></script> <style type="text/css"> @import "http://yandex.st/dojo/1.6.0/dijit/themes/claro/claro.css"; </style> <script type="text/javascript"> <!-- dojo.require("dijit.form.filteringselect"); dojo.addonload(function(){ dijit.byid('dept').focus(); }); --> </script> </head> <body class="claro"> <select name="dept" id="dept" dojotype="dijit.form.filteringselect" > <option value=""></option> <option value="test">test</option> <option value="te...

c# - iTextSharp - XFA fill date/time field -

the workflow this: we download template form, prefill values static, export xml template the xml parsed .net forms app, dynamic values added the resulting xml needs imported pdf template all goes using mergexfadata method on itextsharp, reason, date/time fields not being filled in (textfields , checkboxes work ok). cannot figure out why. searching through forums discovered saying xfa works textfields. why , how work around? also next step need attach attachment pdf form. attachments pdf itextsharp not attach them. have searched many forums none of mentioned methods works me. thank answers @yuri, tried date/time field , worked perfectly. create simple pdf in live cycle 2 fields, 1 text , 1 date/time, , 2 buttons, submit , print. sample pdf here : i filled out form , got xml: <?xml version="1.0" encoding="utf-8"?> <topmostsubform> <text1>chris</text1> <datetimefield1>2012-04-12</datetimefield1> ...

c# - Syntax error in aggregate argument: Expecting a single column argument with possible 'Child' qualifier -

datatable distincttable = dtable.defaultview.totable(true,"item_no","item_stock"); datatable dtsummerized = new datatable("summerizedresult"); dtsummerized.columns.add("item_no",typeof(string)); dtsummerized.columns.add("item_stock",typeof(double)); int count=0; foreach(datarow drow in distincttable.rows) { count++; //string itemno = convert.tostring(drow[0]); double totalitem = convert.todouble(drow[1]); string totalstock = dtable.compute("sum(" + totalitem + ")", "item_no=" + drow["item_no"].tostring()).tostring(); dtsummerized.rows.add(count,drow["item_no"],totalstock); } error message: syntax error in aggregate argument: expecting single column argument possible 'child' qualifier. do can me out? thanks. you might try this: dtable.compute("sum([" + totalitem + "])",""); i.e enclose column name in square bracket...

Java: properly checked class instantiation using reflection -

i'm trying use 1 of simplest forms of reflection create instance of class: package some.common.prefix; public interface { void configure(...); void process(...); } public class myexample implements { ... // proper implementation } string myclassname = "myexample"; // read external file in reality class<? extends my> myclass = (class<? extends my>) class.forname("some.common.prefix." + myclassname); my = myclass.newinstance(); typecasting unknown class object we've got class.forname yields warning: type safety: unchecked cast class<capture#1-of ?> class<? extends my> i've tried using instanceof check approach: class<?> loadedclass = class.forname("some.common.prefix." + myclassname); if (myclass instanceof class<? extends rst>) { class<? extends my> myclass = (class<? extends my>) loadedclass; my = myclass.newinstance(); } else { throw ... // awful ex...

.net - Reading from in-memory Access Database in C# -

please show me few examples of reading in-memory access database (i.e. uploaded website) in c# / .net 4.0. you can't - oledb need real file connection. instead, save access database file system, use oledb connection , command classes work database.

return properties from target called by CallTarget in MSBuild -

i'm new msbuild google don't have idea how return property calltarget in msbuild (see below). not possible or <target name="createdbstgexistsprop"> <!-- see http://stackoverflow.com/questions/1373162/passing-property-group-value-from-one-msbuild-task-to-another why workaround needed --> <propertygroup> <db>$(dbstg)</db> <machine>$(dwhdbstgmachine)</machine> </propertygroup> </target> <target name="checkdbstgexists" dependsontargets="createdbstgexistsprop"> <calltarget targets="dbexists"/> <!-- should pass property doesdbexist further reference created in target dbexists, not seem work --> <message text="test: $(doesdbexist)"/> </target> <target name="dbexists" > <msbuild.extensionpack.sql2008.database taskaction="checkexists" machinename="$(machine)" datab...

mediaelement.js Flash Firefox -

for reason can not mediaelement.js flash player work in firefox. using .m4v , .mp4 files test this. i know firefox can not play .m4v or .mp4 in it's native html5 player don't want encode bunch of videos .ogv , .webm. until .webm takes on market. default flash players 9 , supposed play .mp4 , .m4v versions natively. also, if use multiple sources option , object tag has <param name="flashvars" value="controls=true&poster=../media/echo-hereweare.jpg&file=../media/echo-hereweare.mp4" /> is poster , file paths able use http:// urls rather relative url's? in testing firefox have used both option: <video width="640" height="360" src="../media/echo-hereweare.mp4" type="video/mp4" id="player1" poster="../media/echo-hereweare.jpg" controls="controls" preload="none"></video> and option below: <video width="640" height=...