Posts

Showing posts from April, 2012

.net - C# Cannot write to Application.ExecutablePath, some boxes i can some i cannot? uninstall from this -

so have been writing to environment.specialfolder.applicationdata this data file, upon uninstall needs deleted. using innos setup build installer. works great me. data file hangs out in above path , cause when used try write to application.executablepath certain boxes tested on throw nasty error @ me trying write data there. research , somehow not writable , how came environment.specialfolder.applicationdata that why data file resides in specialfolder.applicationdata. trouble if user uninstalls , reinstalls need file gone. might short coming of knowledge of innos cannot figure out how know file tell innos that. so thought had clever solution: innos can run file when done uninstalling, had program create file "uninstalldata.bat" says: del "the file in special folder application data path" and wrote out drumroll application.executablepath (yes while in development , had forgot was't doable.) so of course square one, need write f...

How can I extract child values from XML with Perl's XML::Twig? -

i parsing xml file , trying access values in xml file. #!/usr/bin/perl -w use strict; use xml::twig; $file = 'files/camelids.xml'; print "file :: $file\n"; $twig = xml::twig->new(); $twig->parsefile($file); # print "twig :: $twig\n"; $root = $twig->root; # print "root :: $root\n"; $num = $root->children('species'); print "num :: $num\n\n\n"; print $root->children('species')->first_child_text('common-name'); sample xml file is: <?xml version="1.0"?> <camelids> <species name="camelus bactrianus"> <common-name>bactrian camel</common-name> <physical-characteristics> <mass>450 500 kg.</mass> <appearance> <in-appearance> <inside-appearance>this in inside appearance</inside-appearance> </in-appearance> </appearance> ...

What's the difference between line-height:1.5 and line-height:150% in css? -

anyone knows it? short version: line-height: 150% static, line-height: 1.5 dynamic. effect more evident on inheriting elements. example: html <div style="font-size: 12px"> <span style="font-size: 24px">test</span> </div> this css div { line-height: 150%; } /* computed line-height: 18px (150% * 12px) */ span { } /* computed line-height: 18px (inherited directly) */ as opposed this: div { line-height: 1.5 } /* computed line-height: 18px (1.5 * 12px) */ span { } /* computed line-height: 36px (1.5 * 24px) */ you may read more @ css2 specs page

how to add a user control from a dll(already referenced) to ui in design mode? -

if first add toolbox, exception thrown, saying dll referenced. and hate add ui programmatically. any idea? have add programmatically? how removing previous reference , browsing dll ?

ruby on rails - nested form & update_attributes -

i having trouble updating data in multi-level nested form. use partials include fields both create & update views, , not have problem creating. updating. essentially structure (simplified) is: user has_one profile profile has_many addresses form_for @user |u| u.fields_for :profile |p| p.fields_for :addresses |a| like said, creating user, profile, , addresses works fine. until attempt update find problems. don't receive error, shows updated. , update user & profile fields, not address fields. here params update stack trace. (again, summarized & formatted) parameters: {"controller"=>"profiles", "action"=>"update", "_method"=>"put", "id"=>"1", "user"=>{"login" => "username", "profile_attributes"=>{"first_name"=>"admin", "addresses_attributes"=>{ "0...

django - How to open a generated PDF file in browser? -

i have written pdf merger merges original file watermark. what want open 'document-output.pdf' file in browser django view. checked django's related articles, since approach relatively different, don't directly create pdf object, using response object "file.", kind of lost. so, how can in django view? from pypdf import pdffilewriter, pdffilereader reportlab.pdfgen.canvas import canvas reportlab.pdfbase import pdfmetrics reportlab.pdfbase.ttfonts import ttfont output = pdffilewriter() input = pdffilereader(file('file.pdf', 'rb')) # number of pages num_pages = input.getnumpages() # register new chinese font pdfmetrics.registerfont(ttfont('chinese_font','/usr/share/fonts/truetype/mac/liheipro.ttf')) # generate watermark on fly pdf = canvas("watermark.pdf") pdf.setfont("chinese_font", 12) pdf.setstrokecolorrgb(0.5, 1, 0) pdf.drawstring(10, 830, "你好") pdf.save() # put on watermark watermar...

How to write custom client-side jQuery validation in ASP.NET MVC 2 RC? -

i've read phil haack's post on custom client-side validation in asp.net mvc 2. want same thing jquery adapter , using asp.net mvc 2 rc (as opposed mvc 2 beta post uses). has been able figure how this? i specially want implement password matching validation (i.e. password & confirm password must match). asp.net mvc 2 rc vs.net project template show how implement on server-side (using propertiesmustmatchattribute ) not on client-side. i assume followed phil haack's instructions here http://haacked.com/archive/2009/11/19/aspnetmvc2-custom-validation.aspx ) on how custom validation working ms ajax client validation. work jquery, you'll need modify microsoftmvcjqueryvalidation.js file: in __mvc_createrulesforfield(validationfield) function, you'll need add case statement. continuing phil's example, you'll need add: case "price": __mvc_applyvalidator_price(rulesobj, thisrule.validationparameters["min"]); break; ...

javascript associative array initialization error? -

<script> var tids = { 308: 1, 312: 1, 313: 1, 314: 1 }; </script> results in "missing } in xml expression arrow pointing first colon in js error console. isn't valid declaration? first should fix <script> tag to <script type="text/javascript"> next, if want use numeric indexes, try declare them string: var tids = { '308': 1, '312': 1, '313': 1, '314': 1 }; please note, however, not able reference them in object notation (i.e. tids.308 ). use arrays instead of objects:

winforms - c# combobox binding to list of objects -

quick question, possible bind combobox list of objects, have selectedvalue property point object, not property of object. i ask because have business objects have references other objects - such 'year' object. year object may need switched out year object. only solution can come have class single property, in case pointing year object. bind combobox list of these , set both display , value members single property. but doing 'lookups' have seems bit of pain?? marlon if set valuemember null selected value object, not property: { public class testobject { public string name { get; set; } public int value { get; set; } } public partial class form1 : form { private system.windows.forms.combobox combobox1; public form1() { this.combobox1 = new system.windows.forms.combobox(); this.suspendlayout(); // // combobox1 // this...

c# - How to read names and versions of assemblies -

i have create application read name of dlls (assemblies) in application path along version. , read same of dll in sub folders. how in c#. can 1 me sample code? edit : how read details of legacy dlls( external dlls- not created in .net) thanks in advance. you should search through given root directory calling directory.getfiles() . can run through result , load every assembly calling assembly.reflectiononlyloadfrom() (cause if load way won't added appdomain, thous no unload needed). with these assembly classes can access getname() function , take version property version information. other properties, not get, can reached through getcustomattribute() function this: ((assemblycopyrightattribute)assembly.getcustomattribute(typeof(assemblycopyrightattribute), true).copyright with these informations should able built list like. update: and here's obligatory linq code sample: var rootpath = @"c:\myroot\folder"; var query = directory...

wpf - How to regenerate (update) LINQ to SQL DataContext? -

i use linq sql in wpf project. have made small changes in database (changed datatype of fields, contain no data). now want regenerate (refresh) linq sql datacontext of project (i use vs 2008). try right-click on .dbml item in solution explorer , choose "refresh" , nothing happens. how update datacontext in visual studio 2008 wpf project? without resorting 3rd party tools, easiest way delete modified tables designer , drag them in server explorer. unfortunately, if you've made manual modifications in l2s designer wont preserved , you'll have manually make changes again. huagati has tool claims able refresh changes haven't tried myself.

python - How to make a class JSON serializable -

how make python class serializable? a simple class: class fileitem: def __init__(self, fname): self.fname = fname what should able output of: json.dumps() without error ( fileitem instance @ ... not json serializable ) do have idea expected output? e.g. do? >>> f = fileitem("/foo/bar") >>> magic(f) '{"fname": "/foo/bar"}' in case can merely call json.dumps(f.__dict__) . if want more customized output have subclass jsonencoder , implement own custom serialization. for trivial example, see below. >>> json import jsonencoder >>> class myencoder(jsonencoder): def default(self, o): return o.__dict__ >>> myencoder().encode(f) '{"fname": "/foo/bar"}' then pass class json.dumps() method cls kwarg: json.dumps(cls=myencoder) if want decode you'll have supply custom object_hook jsondecoder class. e.g. ...

winforms - C# Databound Windows Forms control does not retain value unless you leave the field -

i saw answer in databound windows forms control not recognize change until losing focus . but doesn't answer question me. have exact same situation. on toolstrip_click, go through of controls , force "writevalue()", still reverts previous value before save. can suggest how can fix this? did implement incorrectly? (see code current (non-working) solution.) private void menustrip1_itemclicked(object sender, toolstripitemclickedeventargs e) { // make sure items have updated databindings. foreach (control c in this.controls) { foreach (binding b in c.databindings) { // help: doesn't seem working. b.writevalue(); } } } the code simpler, considerable hack. i'd happy know if there more "proper" fix this. private void menustrip1_itemclicked(object sender, toolstripitemclickedeventargs e) { // make sure text fields have updated forcing // lose focus except lonely little label. ...

php - How to display the <div> as per data count displayed below? -

i have display below snippet according data available in db <div id="testimonial-row"> <div id="testimonial"> <ul> <li>"hello world"</li> </ul> </div> <div id="testimonial"> <ul> <li>"hello world"</li> </ul> </div> <div id="testimonial"> <ul> <li>"hello world"</li> </ul> </div> </div> that is, <div id="testimonial-row"> should created everytime count of data (here, hello world) becomes greater 3, hence in way if data count "16" the <div id="testimonial-row"> should created 6 times data displayed in created 6 ...

iphone - Installing 2.0 sdk simulator -

few days upgrade 10.6 , have install start. downloaded new sdk , install problem has simulator above 3.0! have test things in 2.0 onward, how can this? how can install 2.0, 2.2 , 2.2.1 simulator now? i did research find answer question ( link text ) it's sound similar. if have access apple devforums link thread simulator 2.2.1 no longer available in sdk 3.2.1? the main point of thread "the simulator not appropriate (nor has ever been) kind of old-os regression testing. remember, simulator not emulator, has no os, , doesn't accurately reflect environment code running in." and there no workaround install simulator 2.2.1 , lower snow leopard.

flash - FLEX: getting a folder size -

i'm triying folder size doing: var folderfile:file = new file("file:///somepath/folder"); var foldersize: folderfile.size; but gives me value of 0, how can folder size? there anyway this? tranks no, there's no way automagically. getting size of directory complex , potentially painfully slow operation. there 10s of thousands of files in directory, or directory located on (slow?) network, not mention tape storage , similar scenarios. the file systems don't store directory size information, , way know calculate file-by-file, there's no quick/easy shortcut. so, have rely on solution posted above, and, yes, going slow.

is there a tool to make an rss easy to read or colored? -

i want know , understand structure of youtube's rss feed : http://gdata.youtube.com/feeds/api/videos/-/comedy?v=2&max-results=50 but it's see , not arranged ( please view source ) and want tool clorize , arrange easy read firefox when displays source of webpage. it's not youtube feed, many feeds without breaks , new lines. thanks http://tools.decisionsoft.com/xmlpp.html followed decent text editor: alt text http://img693.imageshack.us/img693/1822/capturadepantalla201001y.png

c# - Socket Connection Error -

i facing wierd socket connection problem in .net windows application.i using socket .net asynchonously communicate legacy intersystems cache database. i have specific timeout value in application, when timeout occurs, user prompted stay connected application. when stay connected, socket not being reset. set timeout 30 mins , stay connected first idle time.then when navigate application works fine. if out navigating in application , stay connected second time, , navigate in app getting socket "host refused" connection error. can assume may socket terminated. wierd part if set application timeout 10 mins, getting socket error second time. when check sockets connected property, still true. not catching exception when call sockets send method. data not passed socket.i have checked other .net code. fine. problem occurs rarely, 1 in 10 times. suggestions helpful. this sounds typical issue resulting firewalls or other tcp settings. firewalls might silently disconnect...

image processing - .NET Graphics.drawstring -

i have uploaded image jpg extension , added text on photo using graphics.drawstring in .net web application. if apply other editing tools rotating image, text added gets blurry. what reason , solution problem? when adding text raster-based image format jpeg (as opposed vector-based formats svg) text no longer separate object, it's coloured pixels photo. transformations on raster images cause "blurriness". to reduce affects add text last not affected other operations. i'm not sure gdi.net default level play level of jpeg compression. low compression not lossy produces large file sizes. should able away 5-10% compression without losing detail while reducing file size, depends on images , how fussy need be.

vb.net - Adding Active Directory sub domain user to main domain group -

i have function works when attempt add user same domain group of same domain. function addusertogroup(byval struserdn string, byval strgroupdn string, byval strgrpdc string, byval struserdc string) boolean dim ouser directoryentry dim ogroup directoryentry dim blnstatus boolean try ouser = new directoryentry("ldap://" & struserdn) ogroup = new directoryentry("ldap://" & strgroupdn) ogroup.invoke("add", ouser.path.tostring) ogroup.commitchanges() blnstatus = true catch ex exception //catch error...send email support end try ouser = nothing ogroup = nothing return blnstatus end function what need able add user sub domain main domain group. example: main domain: geo.com sub domain: customer.geo.com i have user: homer simpson member of customer.geo.com domain. want add user group in geo.com domain. passing correct full adspath non helpful error...

translate one language to another? -

is possible translate 1 language interpreter? heard quercus translate php java? @ first, thought cheap lousy solution give code errors, seems it´s possible so. could translate php other languages, python or ruby? c++ java , on? translating 1 language special case class of programs called compilers, interpreters , translators. this class of program take stream of input symbols ("source code") can usually described formal grammar , output stream of symbols. that output stream of symbols can be: native assembly code, operating system , hardware machine running on. if so, program referred compiler; native assembly code different os and/or hardware. can called compiler referred cross-compiler; to intermediate form can executed virtual machine of kind. isn't true compiler called compiler anyway. java, c#, f#, vb.net, etc "compilers" fall category; to language entirely. called translator , there examples of, say, java c# translators. typical...

Delphi: array of Char and TCharArray "Incompatible Types" -

i've run across "incompatible types" error in comment below few times, , never been happy why isn't directly supported in delphi 2007: program project1; {$apptype console} type tchararray = array of char; procedure doarray(chars: array of char); begin end; function returntchararray: tchararray; var chararray: tchararray; begin result := chararray; end; begin doarray(returntchararray); // [dcc error] project1.dpr(18): e2010 incompatible types: 'array' , 'tchararray' end. shouldn't possible make array type "aliased" array type compatible each other? assuming can't change declaration of doarray (it part of third party library), how write function returning array of char compatible doarray's param? straightforward "function returnachar: array of char;" results in "identifier expected 'array' found" error. tried changing function returning array procedure var "array of char" pram...

.net - GridView Column -

i have gridview bound table, added 1 hyperlink field can see code below: <asp:hyperlinkfield navigateurl="~/logout.aspx?category=mobile&&id=" text ="logout"/> as can see sending 2 query string url. getting both correctly long sending static data. problem want send 1 of gridview column value through query string want , tried: <asp:hyperlinkfield navigateurl="~/logout.aspx?category=mobile&&id='<%gridview1.selectedrow.cells(1).text.tostring%>'" text ="logout"/> i not getting id value per column value same gridview code gridview1.selectedrow.cells(1).text.tostring how should correct syntax can send column value through url? thanks... you'll have convert field template field , bind asp:hyperlink's navigateurl property in databound event of gridview. examples can found here (using bulletedlist instead of hyperlink): http://msdn.microsoft.com/en-us/library/aa479353.aspx ...

android - Why doesn't HttpClient work but HttpUrlConnenction do when posting data to form -

i'm building android app should perform on site 2 cookies , perform post same site these cookies. as mentioned start of , i'm using org.apache.http.client.httpclient perform operation. string requiredcookies = ""; httpcontext localcontext = null; system.out.println("------------------get----------------------"); httpclient httpclient = new defaulthttpclient(); httpget = new httpget("www.mysitegeturl.com"); //creating local instance of cookie store. cookiestore cookiejar = new basiccookiestore(); // creating local http context localcontext = new basichttpcontext(); // bind custom cookie store local context localcontext.setattribute(clientcontext.cookie_store, cookiejar); httpresponse response; try { response = httpclient.execute(get, localcontext); httpentity entity = response.getentity(); system.out.println(response.getstatusline()); if (entity != null) { system.out.println("response content length: " + entity.getconte...

controller - Invoking Rake::Task in rails causes "Don't know how to build task..." -

trying integrate friendly_id gem functionality on controller method. essentially, have market object, has url created based on custom method. since it's based on custom method, friendly_id won't update url when market object gets updated. friendly_id offer redo_slugs rake task, when call within controller, tells me can't build task. running command outside works fine. the code controller looks this: require 'rake' require 'friendly_id' class admin::marketscontroller < applicationcontroller def update if @market.update_attributes(params[:market]) rake_market_slugs end end protected def rake_market_slugs rake::task["friendly_id:redo_slugs model=market"].invoke end end am missing something? or can not inside controller? thank you. calling rake task controller update model object terrible. looking @ the code rake task , can see redo_slugs running delete_slugs , make_slugs tasks. there...

c# - Can I change a user's keyboard input? -

i found keyboard hook code, i'm trying modify purposes: http://blogs.msdn.com/toub/archive/2006/05/03/589423.aspx as overview, want have user press key, 'e', , have keyboard return different character, 'z', whatever app in focus. the relevant method changed looks like: private static intptr hookcallback(int ncode, intptr wparam, intptr lparam) { if (ncode >= 0 && wparam == (intptr)wm_keydown) { //the truely typed character: int vkcode = marshal.readint32(lparam); console.writeline((keys)vkcode); kbdllhookstruct replacementkey = (kbdllhookstruct)marshal.ptrtostructure(lparam, typeof(kbdllhookstruct)); replacementkey.vkcode = 90; // char 'z' marshal.structuretoptr(replacementkey, lparam, false); //now changed set character vkcode = marshal.readint32(lparam); console.writeline((keys)vkcode); } ...

SVN in XCode corruption of pbxuser -

am new svn, sorry if obvious (had no luck googling it, , been on couple of days). i have set subversion repository hosted unfuddle , working working between imac , macbook pro until got error message saying project file had become unreadable. after deleting working copies on both machines , checking project out have tracked down fact user settings file on imac (dave.pbxuser) showing status of m against it, whereas shows ? on macbook. i thought pbxuser should part of global ignore config , should never have m against it. if commit entire project imac project file becomes corrupted again. is fact pbxuser somehow under source control on imac culprit? ideas how happened , how rectify? cheers dave ok have worked around issue. not pretty works. under scm repositories menu, choose repository project in causing problem. important project not open @ time. find .xcodeproj file , click on it. wrapper 3 other files 1 of .pbxuser. select .pbxuser file , delete re...

iphone - UITableview not reloading after UIAlertview -

after entering new item, in delegate method uialertview , call reloaddata of uitableview , not being updated: - (void)tableview:(uitableview *)tableview commiteditingstyle:(uitableviewcelleditingstyle)editingstyle forrowatindexpath:(nsindexpath *)indexpath { // if row deleted, remove list. if (editingstyle == uitableviewcelleditingstyledelete) { if (indexpath.row > 0) { [datcontroller removedata:indexpath.row-1]; [tableview deleterowsatindexpaths:[nsarray arraywithobject:indexpath] withrowanimation:uitableviewrowanimationfade]; } } else if(editingstyle == uitableviewcelleditingstyleinsert) { uialertview *myalertview = [[uialertview alloc] initwithtitle:@"enter item." message:@"" delegate:self cancelbuttontitle:@"cancel" otherbuttontitles:@"ok",nil]; flditem = [[uitextfie...

pep8 - How can I make my Python code stay under 80 characters a line? -

i have written python in lines exceed 80 characters in length, threshold need stay under. how can adapt code reduce line lengths? my current editor (kate) has been configured introduce line break on word boundaries whenever line length reaches or exceeds 80 characters. makes obvious i've overstepped bounds. in addition, there red line marking 80 character position, giving me advance warning of when line going flow over. these let me plan logical lines fit on multiple physical lines. as how fit them, there several mechanisms. can end line \ , error prone. # works print 4 + \ 2 # doesn't work print 4 + \ 2 the difference? difference invisible-- there whitespace character after backslash in second case. oops! what should done instead? well, surround in parentheses. print (4 + 2) no \ needed. works universally, never ever need \ . attribute access boundaries! print (foo .bar()) for strings, can add them explicitly, or implicitly using...

css - Compass blueprint mixins undefined -

i trying compass/sass/haml working using blueprint not having luck blueprint mixins +column(24) just results in sass syntax error undefined mixin column i'm sure missing obvious compass/haml/sass/bluprint combo many things @ once can't sort out. +blueprint like said. obvious. doh!

asp.net - Ajaxcontroltoolkit roundedcornersextender is not working -

Image
following sample code.. cannot find rounded corners table. .. can't fix error... plz,help <cc1:roundedcornersextender id="rce" runat="server" targetcontrolid="tbl" radius="10" corners="all" /> <table id="tbl" runat="server" style="border: medium solid #0000ff; width: 41%;"> <tr> <td> &nbsp; </td> <td> &nbsp; </td> <td> &nbsp; </td> </tr> <tr> <td> &nbsp; </td> <td> &nbsp; </td> <td> &nbsp; </td> </tr> <tr> <td> ...

objective c - How to implement utility application with navigation based flipside? -

i create utility application has navigation based flipside, or "info", view. efficient way accomplish be? think 'simply' need make root view controller flipside view...but understand conceptually...not how go or, @ least, not confident know how go it. i apologize "make app" nature of question have books , books , books...but shakes out differently when want make own project. you can use view controller flipside view, or create / load view in app delegate. in latter case, can set delegate respond info button press, , set transition new view have button (which app delegate responds to) transitions previous view. there basic tutorial found here: http://www.iphonedevsdk.com/forum/iphone-sdk-development/12222-how-do-i-create-uiview-flip-animation.html#post104474 should able @ least started.

console application - Creating a Folder in C#, Applying Permissions, But access is still DENIED? -

so have code below creates directory , gives aspnet permissions on folder created. when run webclient.downloadfile method, says folder created still access denied.. ive created folder on c:/ , tried applying permissions self , see get. still access denied. can help? directoryinfo di = directory.createdirectory(path); system.security.accesscontrol.directorysecurity dsec = di.getaccesscontrol(); dsec.addaccessrule(new system.security.accesscontrol.filesystemaccessrule(@"lv38pce00081461\aspnet", system.security.accesscontrol.filesystemrights.fullcontrol, system.security.accesscontrol.accesscontroltype.allow)); di.setaccesscontrol(dsec); here webclient.download file method im calling. folderid the directory exp: "c:\hello" webclient webclient = new webclient(); webclient.downloadfile(new uri(reader.value), folderid); console.writeline(folderid + " file downloaded"); this method abo...

c# - Wrapping a nested collection -

i'm working on wrapper third party component (not best idea, know) purchased, grid precise. well, exposing of grid properties hasn't been hard far... real issue rows/cells collection. the seniors/leads don't want developers going crazy in those, having sort customrowcollection of customrow objects wrapping bare minimum of actual grid's rowcollection of row objects idea... same goes cells, customrow object should have customcellcollection of customcells wrapping actual gridrow's cellcollection of cell objects. do have advice on how should approach this? can't quite picture design. thanks the customrowcollection wrapper around rowcollection . it's not collection @ all; it's class implements icollection<customrow> , translates each method appropriate method on underlying rowcollection . instance: public void add(customrow r) { _rowcollection.add(r.row); } the problem evident if at, say, indexer: public customrow this[int ...

MOSS 2010 Developer WorkStation -

i moss developer. based on read far sharepoint 2010, have around development workstation - 64 bit beefy ram, , importantly figure out version of os install (windows 2k8 r2, or windows 7 ultimate). i need feedbacks others have gone before me hand-on experiences in setting workstations purpose. welcome suggestion on realistic "baseline" on hardware/software requirements. sharepoint 2010 runs quite on windows 7. there manual steps in installation, they're documented . it's question of os want run. i'm not sure yet make of memory requirements. recommendation developer machines 4 gb, , i'm running 6 gb, without problems.

JavaScript messy code in large projects with jquery etc? -

calling javascript gurus out there. question regarding how structure code, both visually , functionality example wrap in objects using structure: var myapp={ binds:function(){ //put event listeners jquery etc... }, otherfunc:function(){ //do other thing }, init:function(){ //call myapp.binds , other functions , other stuff intialize app. } }; then finally $(document).ready(myapp.init); the thing structure think jslint complains doesn't it? whats pros , cons using structure or there better way structure code? follow pattern $(document).ready(call) putting event listeners , "initializing" app, use separate objects methods , variables? i think "visually" if have large webapp structure looks messy, maybe it's me don't know, input appreciated thanks. using inheritance patterns organize large jquery applications explain in detail , better practice alex http://alexsexton.com/?p=51 its very explain, must see ...

Intel AMT 2.0 PowerUp/PowerDown Issue RemoteControlService/Interface -

i trying turn off intel amt 2.0 blade through remotecontrolservice.wsdl exposes 1 method newopereation. provided on software.intel out dated i.e of 2006. when turn off intel amt 2.0 blade using http://192.168.3.115:16992 turn off not turn on because stops reply ping request. is there issue amt 2.0 blade? can body share code of java using remotecontrolservice.wsdl. used in in .net can not install .net platform run exe. using bios version 5773 you need fix provisioning settings amt blade. go following document http://software.intel.com/file/42139 [goto page 3 bottom] further more need amt.jar file if want use in programmable way.

php - How to generate a dynamic array -

i have generate dynamic menu fetch data database , store result in dynamic array. how achieve in php? arrays dynamic default in php, add more items it. shown in example (assuming database mysql): $result = mysql_query(...); $menu_array = array(); $i = 0; while($row = mysql_fetch_array($result)) { $menu_array[$i] = $row['menu']; $i++; } now $menu_array contains menu elements fetched database.

ruby on rails - Formatting ERB Templates automatically in textmate -

when writing erb templates in ruby on rails using textmate formatting hand pretty sucks. do know of textmate bundle handles formatting of erb templates/views? googling has found nothing. thanks! i think best solution use html (rails) bundle. , when want tidy something, you'll need go bundles menu > html > tidy. that coupled indent selection ( ⌘ - ⌥ - [ ) , handles of reformatting needs. note: unfortunately, when in html (rails) bundle, normal tidy shortcut ⌃ - ⇧ - h gets overridden , instead launches "create partial selected text" when in *.html.erb file. i'm sure there's way change hasn't been big enough deal me investigate.

python - Regex for removing whitespace -

def remove_whitespaces(value): "remove whitespaces" p = re.compile(r'\s+') return p.sub(' ', value) the above code strips tags doesn't remove "all" whitespaces value. thanks the fastest general approach eschews res in favor of string's fast, powerful .translate method: import string identity = string.maketrans('', '') def remove_whitespace(value): return value.translate(identity, string.whitespace) in 2.6, it's simpler, just return value.translate(none, string.whitespace) note applies "plain" python 2.* strings, i.e., bytestrings -- unicode's strings' .translate method different -- takes single argument must mapping of ord values unicode characters unicode strings, or none deletion. i.e., taking advantage of dict 's handy .fromkeys classmethod: nospace = dict.fromkeys(ord(c) c in string.whitespace) def unicode_remove_whitespace(value): return value.t...

help using jquery .ajax() method to pass aggregate data to mvc2 action -

i'm trying use jquery ajax function post mvc2 controller action, parameters include array of (simple) custom class , action not getting data correctly. client: var element1 = { firstname: 'raymond', lastname: 'burr' }; var element2 = { firstname: 'johnny', lastname: 'five' }; var var2 = [element1, element2]; var var1 = 'some string'; var parms = { var1: var1, var2: var2 }; var ajaxargs = { type: "post", traditional: true, url: "/home/test1", data: parms, datatype: "json", success: returnsuccess, error: returnerror }; $.ajax(ajaxargs); server: [httppost] public actionresult test1(string var1, list<testparameterclass> var2) { ... } public class testparameterclass { public string firstname { get; set; } public string lastname { get; set;...

javascript - navigation list issue -

i working on small application below there collection of list items list items should within box no matter how many can on second column. want keep limit on number of list items can displayed not more 10 moment there 10 items 10th item should omitted , "view all" should displayed. once user clicks on view can directed second page , items can displayed. below code. thanks <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>untitled document</title> <style> #container { border: 1px dotted #d7d7d7; padding: 0px 5px 5px 8px; height: 250px; width: 250px; } #heading { } ul { display: inline; } ul li{ display: block; } </style> </head> <div id="c...

c# - SMO code support to both sql 2005 and sql 2008 -

prepared manged c# dll using assemblies of smo of version:10.0.0.0 of sql 2008 , called functions in dll unmanged c++ code. application running sql server 2008 application throwing exception when run sql server 2005 follows: description: not load file or assembly 'microsoft.sqlserver.smo, version=10.0.0.0, culture=neutral, publickeytoken=89845dcd8080cc91' or 1 of dependencies. system cannot find file specified. what reason? failing in sql 2005 because of version mismacth of smo? how can give support sql 2005 , sql2008 in application using single c# dll? i faced same issue before, running application same machine have 2008 , 2005 installed? if not suggest install smo libraries sql 2008 on machine/client on running assembly. this download give libraries

c - Seg Fault when initializing array -

i'm taking class on c, , running segmentation fault. understand, seg faults supposed occur when you're accessing memory hasn't been allocated, or otherwise outside bounds. 'course i'm trying initialize array (though rather large @ that) am misunderstanding how parse 2d array? misplacing bound cause seg fault-- wrong in using nested for-loop this? the professor provided clock functions, i'm hoping that's not problem. i'm running code in cygwin, problem? source code follows. using c99 standard well. to clear: looking understanding (and fixing) reason code produces seg fault. #include <stdio.h> #include <time.h> int main(void){ //first define array , 2 doubles count elapsed seconds. double rowmajor, colmajor; rowmajor = colmajor = 0; int majorarray [1000][1000] = {}; clock_t start, end; //set perform test 100 times. for(int k = 0; k<10; k++) { start=clock(); //first row major for(int = 0; ...

ios4 - problem in displaying JSON data in table view on iphone -

i can parse data , see output not able display them in table view problem 1st tableviews code executing rest functions working that's why getting 0 , how avoid ?? this code - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section { nslog(@" value %d",[jsonarray count]);// 0 return [jsonarray count]; } in method getting 0 valuee - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { nsdictionary *atweet = [jsonarray objectatindex:[indexpath row]]; nslog(@ " divy %@",atweet);// nothing } other codes - (void)connectiondidfinishloading:(nsurlconnection *)connection { [connection release]; nsstring *responsestring = [[nsstring alloc] initwithdata:responsedata encoding:nsutf8stringencoding]; [responsedata release]; nserror *error; sbjson *json = [[sbjson new] autorelease]; nsdictionary *data = (nsdict...

c - Error running OPTIMAL algorithm -

****c:>pager_optimal test 100 file used fifo-test, resident set size 200 error restoring reference stream position error was:: invalid argument****/ pt_entry pte[max_page]; /* page table */ int mem_size; /* physical memory size in page frames */ list free_list_head; /* free list */ list res_set_head; /* resident set */ int total_fault = 0; /* total number of page faults */ int total_ref = 0; /* total number of memory references */ file *stream; int main(int argc, char *argv[]) { /* file *stream;*/ if (argc != 3) { printf("the format is: pager file_name memory_size.\n"); exit(1); } printf("file used %s, resident set size %d\n", argv[1], atoi(argv[2])); if ((stream = fopen(argv[1], "r")) == null) { perror("file open failed"); exit(1); } if( max_page >= (mem_size = atoi(argv[2])) ) { /* fine can go ahead */ start_sim...

http - Post to Web Service from ASP, from Remote Server -

i'm trying post data web service, asp (vbscript), using createobject("microsoft.xmlhttp"). trick is, able post web service if resides on same server. moment post web service remote server or different server, assume if post data never got sent. below example of function use post webservice. keep in mind works on local server, not on remote servers. function httppostdata2(surl, srequest, data) set ohttp = createobject("microsoft.xmlhttp") ohttp.open "post", surl & srequest , false ohttp.setrequestheader "content-type", "application/x-www-form-urlencoded" ohttp.send data httppostdata2 = ohttp.responsetext end function url = apiurl & "myquery" response.write(url & " ") params = apikey & "myparameter=657407" response.write(params & " ") result = httppostdata2(url, null, params) response.write(result) the problem might variation of...

Visual Studio not displaying compile time errors in editor -

for example, when write: string x = "turtle"; x.go(); there no red squiggly line detecting absence of go() method on string. only when compile error detected. i've upgraded windows 7, have visual studio 2008. in old environment errors detected before actual compile. is there setting missing? edit: "tools -> options -> text editor -> c# -> underline errors in editor" checked. i dont have "live semantic" option. maybe need go sp1? you need turn on underline errors in editor , show live semantic errors options in visual studio. these options can found here: tools > options > text editor > c# > advanced > editor help edit: need install sp1 this functionality work .

performance - Buffere write becomes slow after CGBitmapContextCreate -

i have code this... cgcolorspaceref colorspace = cgcolorspacecreatedevicergb(); cgcontextref ctx = cgbitmapcontextcreate(pixelarray, width, height, 8, 4 * width, colorspace, kcgimagealphanoneskiplast); cgimageref createdimage = cgbitmapcontextcreateimage (ctx); uiimage = [[uiimage imagewithcgimage:createdimage] retain]; the problem that, once create cgimage , uiimage buffer (pixelarray), write operations buffer becomes @ least 4x slower. happens on ipad device not on iphone. has anyones face same problem? going on here? here write operation code, , call these in loops (setpixel)... - (rgba*) getpixel:(nsinteger)x y:(nsinteger)y { // bound co-cordinates. x = min(max(x, 0), width - 1); y = min(max(y, 0), height - 1); // yindexes pre populated return (rgba*)(&pixelarray[(x + yindexes[y]) << 2]); } - (void) setpixel:(rgba*)color x:(nsinteger)x y:(nsinteger)y { // bound co-cordinates. x = min(max(x, 0), _width); y = min(max(y, 0), ...

flash - Get Notified of Change in Flex Bitmap or BitmapData? -

in flex, how 1 hook bitmap or bitmapdata variable function notified whenever bitmap's data has changed (pixel has changed, or filter's been added)? i tried setting binding doesn't work. there must way it, because can bind mx:image bitmap via 'source' attribute, , displayed image updates time when modify bitmap. how flex it? blindly redraw bitmap @ every frame, or smart , redraws when bitmap changes? if so, how know when bitmap changes? this sort of semi-educated guess, no testing behind it, take salt. when flex binds source attribute of image , value of .source of type bitmapasset . bitmapasset has .bitmapdata property, reference bitmap in question. i expect binding done flex against .bitmapdata property. i don't see reason why shouldn't able that, too. think you'd have little circular work, though, you'd have create bitmapasset instance , populate bitmapdata want keep tabs on, bind .bitmapdata property of bitmapasset...

c++ - Default type parameter error in template code -

1)template <class t = int, class u = double> //compiles 2)template <class t, class u =double> //compiles 3)template <class t = int, class u> //fails why 1 , 2 compile whereas 3 not? for same reason why: void f(int = 0, int); fails. there no way use 3rd version default parameter: template<class t = int, class u> class b { ... }; b<, short> var; // ??? no such syntax

iphone - Memory still increasing when use CFRelease for ABRecordCopyValue? -

i have problem make headache, create method: -(void) main{ (int = 0; i< 100;i++) { [self getphoneofcontact:i]; } } -(void)getphoneofcontact:(nsinteger)id_contact { abrecordref record = abaddressbookgetpersonwithrecordid(addressbook,id_contact); cftyperef ref1; ref1 = abrecordcopyvalue(record,kabpersonphoneproperty); cfrelease(record); cfrelease(ref1); } i think memory approximate constants because have release memory copied, in reality still increasing each loop i; can explain me :(. thanks! your code wrong. abaddressbookgetpersonwithrecordid call follows core foundation 'get rule'. means not have ownership of return value , not have release it. see core foundation - memory management

flex - In Mate, Sending two or more requests to the server simultaneously? -

i'm using mate's remoteobjectinvoker call methods in fluorinefx based api. however, requests seem sent server sequentiality. is, if dispatch group of messages @ same time, 2nd 1 isn't sent until first returns. there anyway change behavior? don't want app unresponsive while long request processing. this thread understand happens (it talks blazeds/livecylce assume fluorine using same approach). in few words happens is: a)flash player grouping calls in 1 http post. b)the server(blazeds,fluorine etc) receives request , starts execute methods serially, 1 after another. solutions a)have 1 http post per method, instead of 1 http post containing amf messages. can use httpchannel instead of amfchannels (internally using flash.net.urlloader instead of flash.net.netconnection). limited maximum number of parallel connection defined browser. b)have 1 http post implement clever solution on server (it cost lot of development time). can write own parallel processor ...

c++ - CreateProcess (binary injection) cannot reference DLL's -

in following example code binary injection: http://www.security.org.sg/code/loadexe.html i can work, inject second exe primary exe's memory space , run. trouble second exe can not access dll's in startup folder. for example: c:\1.exe c:\2.exe c:\helper.dll if 2.exe injected, starts fails because cannot reference helper.dll. there need differently in relocation? the purpose of experiment create simple drm example decrypts original exe in memory.

asp.net - Singleton issue of provider model -

is singleton requirement of provider performance hit ? because database read/write opertions must taking place through singleton. wouldnt issue multiple users doing read/write operation in site blogger. you should definitly use connection pool, , limit max number of connections 200 depending on hardware , traffic. http://ondotnet.com/pub/a/dotnet/2004/02/09/connpool.html const string connstring = "server=localhost;" + "uid=user;" + "pwd=secret;" + "database=northwind;" + "min pool size=50;" + "max pool size=200"; further tips regarding performance: http://msdn.microsoft.com/en-us/magazine/cc163854.aspx