Posts

Showing posts from March, 2012

c# - How to get the clicked LinkButton text in GridView to a label in Popup Panel -

c# - How to get the clicked LinkButton text in GridView to a label in Popup Panel - i using modal popup within gridview linkbutton. what need utilize value of clicked linkbutton appear on label on popup panel <asp:gridview id="gridview1" runat="server"> <columns><asp:templatefield> <itemtemplate> <asp:linkbutton id="linkbutton1" runat="server" onclick="linkbutton1_click" text='<%#eval("empname") %>'></asp:linkbutton> </itemtemplate> </asp:templatefield></columns> </asp:gridview> <asp:linkbutton id="lnkdummy" runat="server"></asp:linkbutton> <asp:modalpopupextender id="linkbutton1_modalpopupextender" runat="server" dynamicservicepath="" enabled="true" targetcontrolid="lnkdummy" popupcontrolid="panel1"> <...

objective c - Most efficient way to have a live countdown -

objective c - Most efficient way to have a live countdown - i writing app includes countdown. countdown displayed on label, not sure if updating label efficiently. using timer interval of 1 second. there way consume less resources? also, crash on older devices? - (void)viewdidload { [super viewdidload]; //create calendar nsdates gregorian = [[nscalendar alloc]initwithcalendaridentifier:nsgregoriancalendar]; [gregorian settimezone:[nstimezone timezonewithname:@"est"]]; //create nsdate lunchtime based on = [nsdate date]; nsdatecomponents *compsofnow = [gregorian components:(nsweekdaycalendarunit |nsdaycalendarunit | nshourcalendarunit | nsminutecalendarunit |nsyearcalendarunit|nsmonthcalendarunit|nseracalendarunit)fromdate:now]; [compsofnow sethour:12]; [compsofnow setminute:50]; lunchtime = [gregorian datefromcomponents:compsofnow]; //create timer , set text nstimer *timer = [nstimer scheduledtimerwithtimeinterval:1 target:self selector:@selector(timerticked:) us...

sorting - I want to sort array of arrays in Perl, but the result is not sorted -

sorting - I want to sort array of arrays in Perl, but the result is not sorted - i have array of arrays want sort. each element of array array 3 elements. array looks like: my @a = ([2,3,1], [1,2,3], [1,0,2], [3,1,2], [2,2,4]); i want sort in ascending order. when comparing 2 elements, first number used. if there tie, sec number used, , 3rd number. here code. utilize function 'cmpfunc' compare 2 elements. sub cmpfunc { homecoming ($a->[0] <=> $b->[0]) or ($a->[1] <=> $b->[1]) or ($a->[2] <=> $b->[2]); } @b = sort cmpfunc @a; print "result:\n"; $element (@b) { print join(",", @{$element}) . "\n"; } result: 1,2,3 1,0,2 2,3,1 2,2,4 3,1,2 the result sorted, not correct. expect is: 1,0,2 1,2,3 2,2,4 2,3,1 3,1,2 is there error in comparing function? unusual thing is, when set comparing code in block, result correctly sorted. my @c = sort { ($a-...

salesforce - Apex Test Class - How to set a rollup count field in a test class -

salesforce - Apex Test Class - How to set a rollup count field in a test class - trying set value roll summary field in test class improve code coverage. how do it? public class clspreferrediasetext { list<preferredia__c> preferredias; public static preferredia__c[] tobeclosed = new preferredia__c[0]; public static preferredia__c[] newpreias = new preferredia__c[0]; public static preferredia__c loopadd; public static preferredcontact__c[] contactlists = new preferredcontact__c[0]; public static account[] invoicedaccounts = new account[0]; public static preferredia__c[] monkey; public clspreferrediasetext(apexpages.standardsetcontroller controller) { preferredias = (list<preferredia__c>) controller.getselected(); } public void getinitcloseinv() { tobeclosed = [select id, account__c, account__r.id, account__r.name, account__r.accountnumber, specialist__c, ...

asp.net mvc 3 - How do I get the full name of a user in .net MVC 3 intranet app? -

asp.net mvc 3 - How do I get the full name of a user in .net MVC 3 intranet app? - i have mvc 3 intranet application performs windows authentication against particular domain. render current user's name. in view, @user.identity.name is set domain\username , want total firstname lastname you can this: class="lang-cs prettyprint-override"> using (var context = new principalcontext(contexttype.domain)) { var principal = userprincipal.findbyidentity(context, user.identity.name); var firstname = principal.givenname; var lastname = principal.surname; } you'll need add together reference system.directoryservices.accountmanagement assembly. you can add together razor helper so: class="lang-cs prettyprint-override"> @helper accountname() { using (var context = new principalcontext(contexttype.domain)) { var principal = userprincipal.findbyidentity(context, user.identity.name); @pr...

redirect - Facebook page app -

redirect - Facebook page app - i`m admin on facebook fan page. problem when seek create app facebook fan page, facebook redirects me profile, , creating app myself , not facebook fan page. is there way this? i need app id , app secret facebook fan page. kalvin klien, please don't fall on getting out of bed, need utilize user profile create apps, not page profile. documented here: create new app business account create facebook app goes in circles page can company page accounts create apps? if want facebook tell you, please 1) log facebook account 2) switch using facebook page (aka business page) 3) go to: https://developers.facebook.com/apps 4) read error message says: to access page, you'll need switch using facebook page using facebook yourself. facebook redirect facebook-page

sql server 2008 - Determining the most effective and safest table locks during bulk data copy -

sql server 2008 - Determining the most effective and safest table locks during bulk data copy - this going 1 of worst-of-the-worst situations you're going want suggest exclusively different. don't worry, know, , unfortunately there's nil can it, please seek limit answers ones explain smallest alter possible create biggest impact. with said, here's situation: there process replicates info sybase server (15.5) sql server (2008 r2) every 30 minutes during business hours. on sql server, there linked server sybase database copying tables. here's scary part: copying done deleting of existing rows , inserting new ones sybase, in fashion (within stored procedure on sql server, triggered enterprise scheduling software): -- table 1 delete abc1; insert abc1 (col1, col2, col3) select col1, col2, col3 linked.server.dbo.abc1; go -- table 2 delete abc2; insert abc2 (col1, col2, col3) select col1, col2, col3 linked.server.dbo.abc2; go -- ... , on hundreds...

language design - Why are all of the base immutable collections final or sealed in scala? -

language design - Why are all of the base immutable collections final or sealed in scala? - i wrote trait sorting iterables in scala, , took long create class mix in took write trait. why design decision made disallow users writing things like: new list[int] superawesometrait[int]? now if want this, need weird hack like, class stupidlist extends linearseq { val inner = list() /* reimplement list methods calling inner */ } and then new stupidlist[int] superawesometrait[int]. because if write somelist match { case cons(head, tail) => whatever case nil => somethingelse } i don't want logic broken new, unexpected subclass. i suspect you're trying solve problem using subclassing improve solved implicits. scala language-design

Android - scaling a viewgroup (layout) at runtime -

Android - scaling a viewgroup (layout) at runtime - i've got bunch of tiles create single image, rendered on request (by what's portion of total image visible on screen). composite image larger screen. each tile positioned tightly next neighbors create illusion of single image (the single image, if not tiled, big , have oom errors). these imageviews within framelayout, positioned top/leftmargin. targetting api 2.2 / sdk 8 i'm trying scale total image in response user events (button presses, pinch, etc). apparently setscale isn't available until api 11. tried using canvas.scale in ondraw of framelayout setwillnotdraw(false), , ondraw beingness called, no scaling beingness applied (i assume because layout doesn't have graphic information? had assumed it'd render it's children well, guess not unless i'm doing wrong here also). i guess iterate through each tile , scale independently, need reposition each 1 well, each time. i have th...

sql server 2008 - SQL XML Query Pattern? -

sql server 2008 - SQL XML Query Pattern? - i have xml below in 141k xml document. can show sql server 2008 xquery insert 2 temp tables, "country" table "state" kid relationship? thanks. <?xml version="1.0" encoding="utf-8"?> <countries author="michael john grove" title="country, state-province selections" date="2008-feb-05"> <country name="afghanistan"> <state>badakhshan</state> <state>badghis</state> <state>baghlan</state> </country> <country name="albania"> <state>berat</state> <state>bulqize</state> <state>delvine</state> etc a version integer identity column primary key. declare @country table ( countryid int identity primary key, name varchar(50) ) declare @state table ( stateid int identity primary key, countryid int, nam...

Technique for handling ServiceBus Topic subscribers running in Azure staging when using ReceiveMode.ReceiveAndDelete -

Technique for handling ServiceBus Topic subscribers running in Azure staging when using ReceiveMode.ReceiveAndDelete - we have number of topics in azure sb , update our environments through vip swap staging production. when instance running in staging don't want subscribers read , delete messages intended send events our instances running in production slot. the solution have come create subscriptions include roleenvironment.subscriptionid in name. these deleted during roleentrypoint.onstop() avoid unused subscriptions. is there more elegant solution , missing obvious? one approach have configuration setting application understands. can changed between staging/production environments , same config value can used enable/disable things not want in production. service bus can create staging , production namespace , set url in config. azure servicebus azure-appfabric

javascript - Change attr to class with jquery -

javascript - Change attr to class with jquery - i have script: $(document).ready(function() { $('#checkout1').addclass('disabled'); $('#voorwaarden').change(function() { $('#checkout1').attr('disabled', $(this).is(':checked') ? null : 'disabled'); }); }); the script no alter attr disabled. how can alter script thing. when alter #voorwaarden. remove class diabled #checkout1. , when changed next #voorwaarden. add together class , going furter , furter. #voorwaarden checkbox. thanks! simply toggleclass() $(document).ready(function() { $('#checkout1').addclass('disabled'); $('#voorwaarden').change(function() { $('#checkout1').toggleclass('disabled'); }); }); note: http://api.jquery.com/toggleclass/ edited: in case want toggle 'disabled' property, $(document).ready(function() { $('#checkout1').prop(...

insert - How can I tell what row has been inserted into Firebird db via JSP -

insert - How can I tell what row has been inserted into Firebird db via JSP - i using executeupdate(query) insert row firebird database table , while works tells me whether has worked or not. what need know row inserted i.e. when record inserted unique primary key , need know id can referred in later statements. is possible , if how? thanks neil you can utilize returning clause of insert statement , introduced in firebird 2.0: insert ... returning pkfieldname jsp insert firebird

iphone - NSNumber with commas -

iphone - NSNumber with commas - maybe silly reply i'm pretty new on ios.. have show number in specific way in app. currently, have numbers receive service in nsstring. but, e.g. if have number: 123456789, need show in label 123.456.789 .. knows if there way that? edit: add together ios , iphone tags here's site examples of how utilize nsnumberformatter . http://iphonedevelopertips.com/cocoa/formatting-numbers-nsnumberformatter-examples.html nsnumberformatter *formatter = [[nsnumberformatter alloc] init]; [formatter setnumberstyle:nsnumberformatterdecimalstyle]; nsstring *formattedoutput = [formatter stringfromnumber:[attributesdict objectforkey:nsfilesystemfreesize]]; nslog(@"system free space: %@", formattedoutput); if number comes in string first, you'll need create number out of first can using nsstring 's intvalue method: http://developer.apple.com/library/mac/#documentation/cocoa/reference/foundation/classes/nsstring_class/ref...

iphone - UITableView hide first cell -

iphone - UITableView hide first cell - i trying recreate mutual pull downwards refresh user interface see in many apps these days. first cell 1 hidden , has refresh loading on it, how table view start @ index row 1 rather 0 refresh cell hidden? any help appreciated. thanks sam you can @ leah culver's pulltorefresh project , alter code according requirements. iphone objective-c ios xcode

language agnostic - Is bit shifting O(1) or O(n)? -

language agnostic - Is bit shifting O(1) or O(n)? - good afternoon all, i wondering shift operations o(1) or o(n) ? basically curious, create sense computers require more operations shift 31 places instead of shifting 1 place? or create sense number of operations required shifting constant regardless of how many places need shift? ps: wondering if hardware appropriate tag.. some instruction sets limited 1 bit shift per instruction. , instruction sets allow specify number of bits shift in 1 instruction, takes 1 clock cycle on modern processors (modern beingness intentionally vague word). see dan04's answer barrel shifter, circuit shifts more 1 bit in 1 operation. it boils downwards logic algorithm. each bit in result logic function based on input. single right shift, algorithm like: if instruction [shift right] , bit 1 of input 1, bit 0 of result 1, else bit 0 0. if instruction [shift right], bit 1 = bit 2. etc. but logic equation be: if instr...

sqlite - Android SQLiteDatabase query sorting order -

sqlite - Android SQLiteDatabase query sorting order - i have info in database this: alice anderson beatrice benny carmen calzone using code: mdb.query(database_names_table, new string[] { key_rowid, key_name }, null, null, null, null, key_name+ " asc"); or code filter beingness "": mdb.query(true, database_names_table, new string[] { key_rowid, key_name }, key_name + " ?", new string[] { filter+"%" }, null, null, null, null); it sorts above info this: alice beatrice carmen anderson benny calzone is normal behavior? how sort above order , bs , cs together? thanks. you can specify case sensitivity adding collate nocase , either in order by clause, or (preferably) when create table in declaration of particular column. android sqlite

python - How can i make a form using django.contrib.comments.forms? -

python - How can i make a form using django.contrib.comments.forms? - this form file of django.contrib.comments.forms: https://github.com/django/django/blob/master/django/contrib/comments/forms.py i need create object of form , utilize in template. don't want create html form object manually in templates, want reuse contrib.comments.forms. how can it? something this. may need modify code depending on how want process form data. from django.contrib.comments.forms import commentform # views.py dev my_view(request): my_obj = mymodel.objects.get(id=1) form = commentform(my_obj) homecoming render(request, 'comment-template.html', {'form': form}) # comment_template.html <form action="{% comment_form_target %}" method="post"> {% csrf token %} {{ form.as_p }} <input type="submit"> </form> python django forms

crystal reports - Different color of rectangles (even/odd row) -

crystal reports - Different color of rectangles (even/odd row) - i know how color total section (section expert - color - utilize modulo formula) want color rectangles in row different. think best way explain image: http://i40.tinypic.com/2jd4wl.png i made layout using rectangles (hope they're called in english language version) is there way solve this? maybe possibility set background color of ractangle formula? i don't believe drawing objects, including box , line, back upwards conditional colors in cr2008. unfortunately, don't back upwards conditional suppression can't stack objects , selectively suppress them colors want, either. other fields back upwards conditional backgrounds, though. should able away boxes altogether , utilize display fields (whether db fields, formulas, whatever) color report. if want colored boxes no info in it, can sneaky , insert blank text field , conditionally color background (right click on field -> ...

Bash: Create hardlink if destination is inside same volume, copy if not -

Bash: Create hardlink if destination is inside same volume, copy if not - my bash script makes copies of files multiple directories. in order save space , maximize speed, prefer create hardlinks instead of copies, since copies need remain identical during life anyway. the script ran in different computers, though, , there may case destination directory exists in different volume origin's. in such case, cannot create hardlink , need re-create file. how check if origin , destination directory exist in same volume, either hard link or re-create depending on it? a simple way so, seek both: ln "$from" "$to" || cp "$from" "$to" depending upon purposes, creating reference re-create (which lightweight hardlinked file, allows 2 copies edited/diverge in future) might work: cp --reflink=auto "$from" "$to" but, can obtain device filesystem's device id using stat : if [ $(stat -c %...

mysql root password rest -

mysql root password rest - for reason, script below doesn't reset root password. script works in performs steps, when seek log in mysql root new password, doesn't recognize alter , insists utilize old one. here script below: #!/bin/bash echo "resetting root password" sudo /etc/init.d/mysql stop sleep 2 if [ -f /root/mysql.reset.sql ]; rm -f /root/mysql.reset.sql touch /root/mysql.reset.sql else touch /root/mysql.reset.sql fi echo "update mysql.user set password=password('akimbo') user='root'; flush privileges;" >> /root/mysql.reset.sql mysqld_safe --init-file=/root/mysql.reset.sql & /etc/init.d/mysql start sleep 2 echo "done setting mysql password user root. password password." so when seek mysql -uroot -pakimbo complains , works when utilize old password. any ideas? cheers why not utilize mysqladmin command? mysqladmin -u root -p'oldpassword' password newpa...

Load javascript files with ajax -

Load javascript files with ajax - just simple question. (probably basic quess) using xmlhttp able load page, not sure how iclude js files.. how can alter code in images below, able include 2 java script files page loaded ajax? i'm far not java script programmer, needs help. thank you. clientside.php: <html> <head> <title></title> <script src="xmlhttp.js"></script> <script> var urlserver ="serverside.php"; var xmlobj = null; function callserver(urlserver){ xmlobj= xmlhttp.create(); if(xmlobj) { xmlobj.onreadystatechange = responsefromserver; xmlobj.open("get", urlserver, true); xmlobj.send(); } } function responsefromserver() { if (xmlobj.readystate == 4) { if (xmlobj.status == 200) { document.getelementbyid("main").innerhtml = xmlobj.responsexml.getelementsbytagname(...

c# - How to get error message when a webservice method throw exception. -

c# - How to get error message when a webservice method throw exception. - i utilize webserviceproxy.invoke phone call webservice method. realized 1 of parameter function handle error coming when method throw exception. i seek method get_message() error message. work-well when access localhost. when access method remote computer, message changed standard error: "there error processing request". callws = function (args) { // phone call webservice fill content panel sys.net.webserviceproxy.invoke(_servicepath, _servicemethod, false, { contextkey: args }, function.createdelegate(this, onsubmitcomplete), function.createdelegate(this, onsubmiterror), args); } onsubmitcomplete = function (result, usercontext, methodname) { ... } onsubmiterror = function (result, usercontext, methodname) { // note: result.get_message() contain exception message when // accessed localhost, contain "there error processing request...

java - Why doesn't my owned one-to-many relationship get persisted to the GAE datastore? -

java - Why doesn't my owned one-to-many relationship get persisted to the GAE datastore? - i have 2 classes defined , mapped gae datastore - person class , locationstamp class, represents single latitude/longitude combination along timestamp. there owned one-to-many mapping between person , locationstamp , implemented on similar lines a forum post on one-to-many relationships. in dao person , have next method: public locationstamp addlocationstampforcurrentuser(locationstamp ls) { persistencemanager pm = getpersistencemanager(); person p = getprofileforcurrentuser(); p.getlocationstamps().add(ls); pm.currenttransaction().begin(); seek { pm.makepersistent(p); pm.currenttransaction().commit(); homecoming ls; } { if (pm.currenttransaction().isactive()) { pm.currenttransaction().rollback(); } pm.close(); } } when seek using method add together ...

php - Find a url in content a site by url it? -

php - Find a url in content a site by url it? - i want search content site url site, if existence url (for example: http://www.mydomain.com/) homecoming true else false. if existence url next list, homecoming false: - http://www.mydomain.com/blog?12 - www.mydomain.com/news/maste.php - http://www.mydomain.com/mkds/skas/aksa.html - www.mydomain.com/ - www.mydomain.com i want accsept(find) as(only): http://www.mydomain.com/ or http://www.mydomain.com i tried as: $url = 'http://www.usersite.com'; $ch = curl_init(); curl_setopt($ch, curlopt_url,$url); curl_setopt($ch, curlopt_returntransfer, 1); $contents = curl_exec($ch); curl_close($ch); $link="/http:\/\/mydomain.com/"; if(preg_match("/". preg_quote($link,"/"). "/m", $contents) && strstr($contents,"http://www.mydomain.com")){ echo 'true'; } else{ echo 'false'; } but do...

How do you use Ruby CSV converters? -

How do you use Ruby CSV converters? - suppose have next file: textfield,datetimefield,numfield foo,2008-07-01 17:50:55.004688,1 bar,2008-07-02 17:50:55.004688,2 the ruby code read .csv like: #!/usr/bin/env ruby require 'csv' csv = csv($stdin, :headers => true, :converters => :all) csv.each |row| print "#{row}" the_date = row['datetimefield'].to_date end that code gives error message: ./foo2.rb:8:in `block in <main>': undefined method `to_date' "2008-07-01 17:50:55.004688":string (nomethoderror) what gives? i've read the docs, don't it. edit: yes, parse fields individually. point of question want larn how utilize documented converters feature. your date times don't match csv::datetimematcher regexp csv uses decide whether should effort date time conversion. looks of it's doing because of fractional seconds you've got. you either overwrite constant or write own conv...

wpf - How to center a Table or a List horizontally in a FlowDocument? -

wpf - How to center a Table or a List horizontally in a FlowDocument? - below sample code default wpf application's mainwindow.xaml. first , lastly 'block's in document paragraphs , middle 1 table. table appear @ left border of column , area right of table blank. center table in space. i have tried putting table within 'section', 'paragraph' etc, didn't have luck. floater within paragraph works, table flow next paragraph. can using 2 empty columns on left , right way calculate widths dynamically, looks overkill. thanks jeevaka <window x:class="flowdocument.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" title="mainwindow" height="700" width="700"> <flowdocumentpageviewer> <flowdocument> <paragraph fontsize="24">moon...

linux - search and add a pattern in a big file -

linux - search and add a pattern in a big file - i have big apache configuration file , in each of virtualhost sections, want add together own log entry. wondering if can script. my current configuration file this; servername abc.com information. … …… and want have like; servername abc.com customlog "/usr/local/logs/abc.com.log" information. … …… is possible sort of script? have lots , lots of such virtualhost entries, manually updating impossible.. ideas? awk can much simpler use. awk 'nr==3{print "my log"}1' input_file nr built-in variable tracks line numbers. you can utilize -v , variable name pass values dynamically instead of hard-coding in script. eg. awk -v line="$var" 'nr==line{print "my log"}1' input_file . in case, line awk variable , $var can bash variable defined outside of awk's scope. test: [jaypal:~/temp] cat file servername abc.co...

authentication - Authenticate a user from a page tab -

authentication - Authenticate a user from a page tab - i'm trying create facebook page tab people can vote favorite video or music track bunch of embedded files. need unique id each user create sure can vote once. signed_request contains user's id if have authorized app. i have tried have users authorize app using fb.login() javascript api, error: an error occurred remix // rework vote. please seek later api error code: 191 api error description: specified url not owned application error message: invalid redirect_uri: given url not permitted application configuration. as far know, have not set redirect url. need set somewhere, or not right approach user authenticate page tab? you must specify both "site url" (or "mobile web url") , "app domain" utilize oauth flow... see fill details on https://developers.facebook.com/docs/authentication/#redirect-uris authentication facebook-page facebook-authenti...

php - How to free memory from Doctrine? -

php - How to free memory from Doctrine? - if have entity repository , invoke findall() method, how able free memory afterwards? ran little test using $entitymanager->clear(), did not job. in advance help! do need records? can filter results, less objects created. problem php is, won't allow free memory until process has ended. you can seek unset() if need records. aware memory won't free, think garbage collector of php has problem cycling references, doctrine guess has such references powerful. a similar question yours example: why php doctine's free() not working? if command line mass iteration can please try $this->_em->detach($row[0]); as described here: http://www.doctrine-project.org/blog/doctrine2-batch-processing php doctrine

html - add target blank on custom php code -

html - add target blank on custom php code - how can open link in window? <?php if(get_option_tree('rss')) { ?> <a href="<?php get_option_tree('rss',$theme_options,'true'); ?>" id="rss" title="rss" class="tt_top"></a><?php } ?> you'll need add together target="_blank" to 'a' tag php html hyperlink

php - How do I call a Class->Method from strings? -

php - How do I call a Class->Method from strings? - it possible phone call class , method strings? something like: // $_request['var'] = 'house-kitchen'; $var = explode('-',$_request['var']); echo $var[0]->$var[1]; the improve way try. i did seek : $house = new stdclass(); $house->kitchen = "visible result"; $_request['var'] = 'house-kitchen'; $var = explode('-',$_request['var']); echo $$var[0]->$var[1]; it works. careful : need utilize double $ first element (to utilize variable $var[0] name). and careful : it's high security breach (you allow phone call methods on current defined class). php string class function methods

winapi - Sharing GlobalAlloc() memory from DLL to multiple Win32 applications -

winapi - Sharing GlobalAlloc() memory from DLL to multiple Win32 applications - i want move caching library dll , allow multiple applications share single pointer allocated within dll using globalalloc(). how accomplish this, , result in important performance decrease? you , there won't performance implication single pointer. rather utilize globalalloc , legacy api, should opt different shared heap. illustration simplest utilize com allocator, cotaskmemalloc . or can utilize heapalloc passing process heap obtained getprocessheap . for example, , neglecting show error checking: void *mem = heapalloc(getprocessheap(), heap_zero_memory, size); note need worry heap sharing if expect memory deallocated in different module created. if dll both creates , destroys memory can utilize plain old malloc . because modules live in same process address space, memory allocated module in process, can used other module. update i failed on first reading of question pi...

html - min-width is not working in IE for frozen layout -

html - min-width is not working in IE for frozen layout - i want create frozen layout in website template, have problem in net explorer. i create this <div id="newsblock"> <div id="aboutus"> <h1></h1> <span class="opendaybanner"></span> <p>you can replace paragraph above text describing faq system. here's example: if have questions our web site, our products or our services, there’s chance you’ll find reply here</p> </div> </div> for css create this div#newsblock{ min-width: 1300px; //this work firefox , chrome width:100%; overflow: hidden; height: 510px; background-image:url(../images/aboutstartupbg.png); background-repeat: repeat-x; } using min-width , percentage value width create layout frozen in firefox , chrome doesn't work in ie!! suggestions please you have define min-width property of <p...

asp.net mvc 3 - Custom Domain Mapping in Azure -

asp.net mvc 3 - Custom Domain Mapping in Azure - i have .net mvc 3, sql server application running on azure. has 2 web role instances , single worker role instance. we allow customers insert iframe (i know, not ideal, bare me) site shows our content. to content, have public page accepts companies unique identifier. instance, stackoverflow utilize 'http://myapplication.com/stack-overflow'. homecoming html page specific company. we thought of mapping cname record on clients side straight content on our application. understand need accept, in stackoverflow's case, 'stack-overflow.myapplication.com' find extract subdirectory , homecoming content @ 'http://myapplication.com/stack-overflow'. can shed lite on how done on azure? any help much apprenticed. regards, brian it same azure , iis deployed application. need map custom sub-domains cname cloudapp.net domain. not alter in service definition and/or configuration files. , withing ...

c++ - Should pointers to "raw" resources be zeroed in destructors? -

c++ - Should pointers to "raw" resources be zeroed in destructors? - when wrap "raw" resources in c++ class, in destructor code release allocated resource(s), without paying attending additional steps zeroing out pointers, etc. e.g.: class file { public: ... ~file() { if (m_file != null) fclose(m_file); } private: file * m_file; }; i wonder if code style contains potential bug: i.e. is possible destructor called more once? in case, right thing in destructor clear pointers avoid double/multiple destructions: ~file() { if (m_file != null) { fclose(m_file); m_file = null; // avoid double destruction } } a similar illustration made heap-allocated memory: if m_ptr pointer memory allocated new[] , next destructor code ok? // in destructor: delete [] m_ptr; or should pointer cleared, too, avoid double destruction? // in destructor: delete [] m_ptr; m_ptr = null; // avoid double destruction no. usefu...

c# - how to make only one USB port visible for an application -

c# - how to make only one USB port visible for an application - im developing c# application needs connect multiple usb devices , want application able see 1 usb port @ time not stop connections or powerfulness port. have thought can utilize or do? usb follows tree topology. every connection in usb chain has path associated. can filter that, i.e. hide entries not in path want create visible. so: enumerate usb devices connected remove devices not on choosen path list show list user c# usb

To get the Current latitude and longtitude in android Application -

To get the Current latitude and longtitude in android Application - hi tried latitude , longtitude without using onlocationchanged ,by next link .but got unknown error.why error occur?find current location latitude , longitude import java.sql.date; import java.sql.sqlexception; import java.text.simpledateformat; import java.util.timer; import java.util.timertask; import org.ksoap2.soapenvelope; import org.ksoap2.serialization.soapobject; import org.ksoap2.serialization.soapprimitive; import org.ksoap2.serialization.soapserializationenvelope; import org.ksoap2.transport.httptransportse; import android.app.activity; import android.app.alertdialog; import android.content.broadcastreceiver; import android.content.context; import android.content.dialoginterface; import android.content.intent; import android.content.i...

mysql table is marked as crashed and last (automatic?) repair failed -

mysql table is marked as crashed and last (automatic?) repair failed - i repairing table suddently server hanged , when returned tables ok 1 showing 'in use' , when seek repair doesn't proceed. error 144 - table './extas_d47727/xzclf_ads' marked crashed , lastly (automatic?) repair failed what can repair it? go info folder , seek running myisamchk -r <table_name> . should stop mysql process first. if doesn't work, can seek myisamchk -r -v -f <table_name> . mysql table repair

JavaScript / JQuery variable need to change.. on click. Delete old number add new one -

JavaScript / JQuery variable need to change.. on click. Delete old number add new one - basically i'm trying random number generated alter random number 1 time clicked on button. cannot figure out how unselect form selected i'm trying how below jquery. var randomnum1 = math.ceil(math.random(20)*10000); var randomnum2 = math.ceil(math.random(20)*10000); var randomnum3 = math.ceil(math.random(20)*10000); var randomnum4 = math.ceil(math.random(20)*10000); $( "#race-again" ).click(function() { $( ".one" ).css( { marginleft: "0" }); $( ".two" ).css({ marginleft: "0" }); $( ".three" ).css( { marginleft: "0" }); $( ".four" ).css( { marginleft: "0" }); $( "#slide2" ).animate( { margintop: "0" }, { duration: 1000 }); $( "#slide3" ).animate( { margintop: "0" }, { duration: 1000 }); $( "#slide4" ).animate(...

javascript - Check value of starting characters of an input Jquery -

javascript - Check value of starting characters of an input Jquery - i have text field can take input of kind. based on input, need create fields hidden , others unhidden. want set status within first status check first 3 characters of input value here code first condition: $("#accountcodes").live("focusout",function(){ var code = $(this).val(); if(code>30000){ alert("t1 t4 codes needed"); $(this).parents("tr").find('#t1').removeattr('hidden','hidden'); $(this).parents("tr").find('#t2').removeattr('hidden','hidden'); $(this).parents("tr").find('#t3').removeattr('hidden','hidden'); $(this).parents("tr").find('#t4').removeattr('hidden','hidden'); } }) i want set status within if statement(if within if) check if first 3 characters start 310 or 311 else e.g if u...

c# - How store a bitmap converted to 1bpp to a monochrome bmp file on the Compact Framework? -

c# - How store a bitmap converted to 1bpp to a monochrome bmp file on the Compact Framework? - after converting 24-bit bitmap 1-bit bitmap, run problem when store bitmap file 24-bit 1 time again , not 1-bit (monochrome) image. i need 1-bit bitmap file sending bluetooth printer. any ideas or code-snippets on how this? edit: currently, i'm using next code save bitmap: system.drawing.bitmap.save("path\filename.bmp", system.drawing.imaging.imageformat.bmp) on net see couple of ways on compact framework: in this related question saving 1bpp using compact framework, there's win32 api solution available saving 1bpp info disk. converting using pixelformat enum, may not work on compact framework. converting using win32 api, thorough explanation of code , total project available in zip. should work on compact framework, i'm not 100% sure whether apis available there. i don't have cf installation handy, other...

json - JavaScriptSerializer and ASP.Net MVC model binding yield different results -

json - JavaScriptSerializer and ASP.Net MVC model binding yield different results - i'm seeing json deserialization problem can not explain or fix. code public class model { public list<itemmodel> items { get; set; } } public class itemmodel { public int sid { get; set; } public string name { get; set; } public datamodel info { get; set; } public list<itemmodel> items { get; set; } } public class datamodel { public double? d1 { get; set; } public double? d2 { get; set; } public double? d3 { get; set; } } public actionresult save(int id, model model) { } data {'items':[{'sid':3157,'name':'a name','items':[{'sid':3158,'name':'child name','data':{'d1':2,'d2':null,'d3':2}}]}]} unit test - passing var jss = new javascriptserializer(); var m = jss.deserialize<model>(json); assert.equal(2, m.items.first().items.first().data...

windows phone 7 - Event atStart App? -

windows phone 7 - Event atStart App? - i'm starting writing little app @ wp7. consider 1 thing. there event "atstart"? want utilize textbox display actual info text , thought event "atstart/atlaunch" perfect it. thanks there no "atstart" event - there application.launching event fired when application starts up. there onnavigatedto virtual method can override on page level invoked when page first navigated to. sounds onnavigatedto might looking for. @ point can alter text property of textblock (which identified x:name ) nowadays in page xaml file. windows-phone-7

MySql SELECT query not working after INSERT query -

MySql SELECT query not working after INSERT query - i have table next structure: create table emp ( id int( 11 ) not null auto_increment, fname varchar( 20 ) character set latin1 collate latin1_swedish_ci null , lname varchar( 20 ) character set latin1 collate latin1_swedish_ci null , category varchar( 20 ) character set latin1 collate latin1_swedish_ci null , primary key (id) ); i first inserted null values table. inserted 3-4 records (used auto increment). there huge select query in bring together table 7 other tables. when run select query 1 null record in table, query works. if run select query after inserting few values in above table, select query hangs , consuming whole lot of cpu. cause?? please help. update 1: my query select * g, id, j, epm, isg, des, eng, pace, mal, msa, u, sa, db, qa, s, mk, p, sre, sec, t t.st = 'open' , t.id = j.pid , t.g_id = g.gid , t.pu_id = id.puid , t.a_id = epm.aid , t.i_id = isg.iid , ...

Playing video in Android in overlapped view -

Playing video in Android in overlapped view - i wish play video file in application when user performs action. googled code samples it, samples found play video within pre-defined view in application. need different: launch video player on top of application, in overlapped full-screen window/view. i tried next code, video window not come up: videoview videoview = new videoview(this /* activity */); videoview.setlayoutparams(new layoutparams(layoutparams.wrap_content, layoutparams.wrap_content)); videoview.setmediacontroller(new mediacontroller(videoview.getcontext())); videoview.setvideopath(videofile.getabsolutepath()); videoview.setvisibility(view.visible); videoview.requestfocus(); videoview.start(); videoview.bringtofront(); what should create player show up? try create activity shows videoview , works dialog. activity dialog simple code , can samples easily. set theme dialog. android android-mediaplayer

Android: Create a new intent with a button from a GridView (GridView with Navigation buttons) -

Android: Create a new intent with a button from a GridView (GridView with Navigation buttons) - i have created class of type baseadapter populated buttons - when click on button want load new intent. has proven hard on 2 levels: you cannot associate event button (one creates new intent) within adapter. why send buttons array adapter (this solution works, messy) even though buttons created within same activity - cannot create new intent activity. exeption great have not gotten try...catch statement work. i have tried reflection, creating buttons within activity , passing them through, passing context (to phone call context.startintent(...)) my question: can show me how create buttonadapter each button creates new intent - of same type original activity? update: here code because getting answers people think struggling onclicklisteners: public class buttonadapter extends baseadapter { private context _context; private button[] _button; public buttonad...

iphone - i want make my view transparent so that form present view the previous view should me slightly visible -

iphone - i want make my view transparent so that form present view the previous view should me slightly visible - i want create view transparent show the previous view visible,i tried below not working , using interface builder create view,please help me out. @implementation cylinderborestotal (void)viewdidload { [super viewdidload]; self.view.backgroundcolor = [uicolor clearcolor]; self.view.alpha = 0.2; self.view.opaque = no; are sure there underneath self.view ? views uiviewcontroller not underneath cylinderborestotal's self.view you may capture image of view first, , insert current view instead. (expensive) iphone uiview uiviewcontroller

python - xpath function starts-with not returning all required information -

python - xpath function starts-with not returning all required information - when using xpath within scrapy shell select email addresses (p) tag on webpage xpath returns links within particular paragraph. such i've attempted utilize starts-with function farther refine info want returned, successful cuts off ends of email addresses. hxs.select('//*[@id="rightcol02"]/p/a[starts-with(@href,"mailto")]') above returns incomplete email addresses. when running hxs.select without starts-with function have observed following: hxs.select('//*[@id="xxxxxxx"]/p/a') - (returns links ends of url's , email addresses cutting off.) hxs.select('//*[@id="xxxxxxx"]/p/a/@href') - (returns finish email address , url.) question how starts-with capture entire email address? i have tried next unsure syntax should be: hxs.select('//*[@id="xxxxxxxx"]/p/a/@href[starts-with("mailto:")]') ...

ssl - Silverlight cross domain error while working in the same domain -

ssl - Silverlight cross domain error while working in the same domain - i'm trying access .asmx web service ssl , silverlight client application, things have done: 1. have crossdomain.xml (only need clientaccesspolicy.xml or crossdomain.xml). 2. have tag in servicereferences.clientconfig file. 3. when phone call webservice ssl ("https:// . . .") cross domain error , when alter access point without ssl ("http:// . . .") works! 4. browsed webservice address , without ssl, boath works. how can cross domain error while working @ same domain?... make sure have proper entry ssl in clientaccesspolicy.xaml . can check out on msdn http://msdn.microsoft.com/en-us/library/cc645032%28v=vs.95%29.aspx. if web service hosted in same web application silverlight application can pass relative path ws in endpoint configuration of client (.clientconfig) , crossdomain/clientaccesspolicy files won't required. example, instead of using address="http://localho...

c++ - How to print the position -

c++ - How to print the position - since x_str,y_str local, not getting right output in function. (illegal chars printed in place of x_str , y_str) dont want add together 2 more fellow member variables x_str,y_str class. hence replacement of function right output. string pos::getposreport(){ string x_str; x_str = x; string y_str; y_str = y; homecoming string("(" + x_str + "," + y_str + ")" ); } edit: class pos { int x; int y; public: pos(); pos(pos const&); pos(int,int); pos& operator=(pos const&); bool operator==(pos const&); bool operator!=(pos const&); void setpos(pos const&); void setpos(int,int); void setx(int); void sety(int); int getx() const ; int gety() const ; string getposreport(); virtual ~pos(); }; std::stringstream ss; ss << "(" ...

javascript - Display hidden form field based on select box choice -

javascript - Display hidden form field based on select box choice - here form element have. <select id="state" name="state" style="width: 212px;"> <option value="nsw">new south wales</option> <option value="qld">queensland</option> <option value="vic">victoria</option> <option value="nt">northern territory</option> <option value="tas">tasmania</option> <option value="sa">south australia</option> <option value="wa">western australia</option> <option value="act">australian capital territory</option> <option value="notinoz">not in australia</option> </select> what want below add together select box element , if user chooses "not in australia" in options above. after cleanest lightest code possbile. i presuming create div , set v...