Posts

Showing posts from January, 2015

java - Audio Stream Transcoding with Android -

let me first state not know java. i'm .net developer solid c# skills, i'm attempting learn java , android sdk @ same time (i know it's not ideal, oh well, i'm adventurous :)) that said, end goal write streaming media player android can accept windows media streams. i'm okay restricting myself android 2.0 , greater if need to. current device motorola droid running android 2.0.1. there 1 online radio service listen religiously on pc offers windows media streaming, , i'd transcode stream android device can play it. is such thing possible? if so, feasible (i.e., cpu intensive , kill battery)? should looking doing ndk in native code instead of java? i'm not opposed writing sort of service in between runs on desktop computer (even in c#), ideally i'd explore purely device-based options first. should start? thanks in advance insight can provide! having proxy on pc captures windows audio output, encodes it, , sends phone possible. had ...

api - How to decode Google spreadsheet's Json respose as a Php Array -

my google docs spreadsheet call returns response in json format (i need after "rows") please @ formatted response here : ) i use php's json_decode function parse data , use (yes, awful @ php) code returns null, , according documentation, null returned "if json cannot decoded" . $json = file_get_contents($jsonurl); $json_output = json_decode($json); var_dump ($json_output); // returns null basically, want accomplish make simple array first row values of json response. like $array = {'john','john handcock','email@yahoo.com','2929292','blanc'} you guys genius, appreciate insight , on much! answer "sberry2a" mentions bellow, response not valid json, google offers zend json library purpose, tho decided parse tsv-excel version instead :) the data in link provided not valid json. have provided appears decoded version. can tell in not json because array keys not quoted. ...

sql - Getting the maximum value of records -

i having table called withdrawals has : name, year, period, amount. ex: name year period amount -------------------------------- jim 2010 1 100 jim 2009 4 99 jim 2009 3 17 kim 2007 2 234 ryu 2008 5 555 i stuck can't latest value name & amount has recent year latest period. i tried use query: select max(year), max(period), name withdrawarls but got wrong results. so, how can correct values: jim, 2010, 1, 100 kim, 2007, 2, 234 ryu, 2008, 5, 555. in mysql , postgresql : select t.* ( select distinct name mytable ) td join mytable t on (t.year, t.period) = ( select year, period mytable ti ti.name = td.name order name desc, year desc, period desc limit 1 ) in sql server : select t.* ( select distinct name mytable ) td cross ...

.net - Deserializing XML into class obj in C# -

this 1 of entries have in huge xml file of on 200 such entries. <tradefills> <tradefill> <broker>xxx</broker> <customeraccount/> <qwfilltransid>xxxxxxxxxxxxxxxxxxx</qwfilltransid> <qwprevtransid>xxx</qwprevtransid> <qwgrouptransid>xxxxxxxxxxxxxxxxx</qwgrouptransid> <grouptransid>xxxxxxxx</grouptransid> <transid>x</transid> <service>xxxxxxxxxxxxxxxx</service> <symbol>xx</symbol> <exchange>xxxxx</exchange> <instclass>xxxxxxxx</instclass> <instsubclass>xxxxxxx</instsubclass> <contractsymbol>xxxx</contractsymbol> <expirationdate>xxxxxxxx</expirationdate> <month>xx</month> <year>xxxx</year> <strike>xxx</strike> <tradepcu>xxxx</tradepcu> <buy>x</buy> <quantity>xx</quantity> <price>xxxxx</price...

mpmovieplayercontroller - Customizable non-full screen video player in iPhone -

i know there mpmovieplayercontroller present in iphone play movies from. isn't customizable in real sense. also, if wanted play movies non-full screen mode, isn't possible today. i wanted inquire if knows future roadmap of iphone sdk, there going such customizable video player upcoming? also, possible write new video player scratch (maybe including codecs), in case part of sdk should referred , how? some in area appreciated. thanks, saurabh i don't know of in future customizable video player. however, if there few videos want play in non-fullscreen mode, there option. uiimageview supports animation. so, if can export videos images, can have them display in uiimageview. for example, //load images here youimageview.animationimages = [nsarray arraywithobjects:[uiimage imagenamed:@"1.png"], [uiimage imagenamed:@"2.png"], [uiimage imagenamed:@"3.png...

asp.net mvc 2 - MVC 2 Client and Server Validation with Data Annotations - Required not working -

i have create view passed viewmodel. viewmodel contains following: namespace myproject.viewmodels { public class myobjectcreateview { public myobject myobject { get; set; } public list<otherobject> otherobjects { get; set; } } } the objects generated using entity framework. have metadata partial class myobject: [metadatatype(typeof(myobjectmetadata))] public partial class myobject { // validation rules myobject class public class myobjectmetadata { // validation rules myobjectid [displayname("myobject")] [required(errormessage = "please enter myobject id number.")] [displayformat( applyformatineditmode=true, convertemptystringtonull=true, htmlencode=true)] [datatype(datatype.text)] [stringlength(25, errormessage = "must under 25 characters.")] public object myobjectid { get; set; ...

export - Extract Gantt Data from Visio Document Using C# -

hey have series of gantt charts in visio 2007 documents want extract. have looked @ visio sdk appears creating new documents , plugins visio itself. know can export chart text or ms project mpx file looking way load data visio document itself. thanks

Circular effect in ticker-silverlight -

i working on silverlight ticker application, 5 links visible , moving ticker(right left). able parse i/p xml file , getting title , corresponding urls, coming in page, moving ticker , circular effect missing.means continuous flow of links not proper. <grid x:name="layoutroot"> <stackpanel x:name="mystackpanel" grid.column="1" orientation="vertical"> <canvas> <canvas.resources> <storyboard x:name="sb"> <doubleanimation x:name="da" begintime="00:00:05" storyboard.targetname="linklist" storyboard.targetproperty="(canvas.left)" from="0" to="-500" duration="0:0:5" repeatbehavior="forever"/> </storyboard> </canvas.resources> <listbox x:name="linklist...

python - How do you check if an object is an instance of 'file'? -

it used in python (2.6) 1 ask: isinstance(f, file) but in python 3.0 file removed . what proper method checking see if variable file now? what'snew docs don't mention this... def read_a_file(f) try: contents = f.read() except attributeerror: # f not file substitute whatever methods plan use read . optimal if expect passed file object more 98% of time. if expect passed non file object more 2% of time, correct thing is: def read_a_file(f): if hasattr(f, 'read'): contents = f.read() else: # f not file this if did have access file class test against. (and fwiw, have file on 2.6) note code works in 3.x well.

matlab - How can I contour plot a custom function? -

i have custom function returns either 0 or 1 depending on 2 given inputs: function val = myfunction(val1, val2) % logic determine if val=1 or val=0 end how can create contour plot of function on x,y coordinates generated following meshgrid? meshgrid(0:.5:3, 0:.5:3); this plot display function 0 or 1 on contour map. if function myfunction not designed handle matrix inputs, can use function arrayfun apply corresponding entries of x , y : [x,y] = meshgrid(0:0.5:3); %# create mesh of x , y points z = arrayfun(@myfunction,x,y); %# compute z (same size x , y) then use function contour generate contour plot above data. since z data has 2 different values, make sense plot 1 contour level (which @ value of 0.5, halfway between 2 values). might want instead use function contourf , produces color-filled contours show ones , zeroes are: contourf(x,y,z,1); %# plots 1 contour level, filling area on either %# side different color ...

c# - Injecting a variable into the Mono.CSharp.Evaluator (runtime compiling a LINQ query from string) -

i'm using mono.csharp library emit code. following question on (http://stackoverflow.com/questions/3407318/mono-compiler-as-a-service-mcs) managed mono.csharp evaluating correctly on microsoft clr. to add flexibility in app i'd able customize query @ runtime - allowing user provide linq query string gets parsed , hits database when executed. given basic snippet of code: iqueryable<contact> contacts = getcontacts(); string query = "from contact in contacts contact.name == \"name\" select contact"; var queryableresult = mono.csharp.evaluator.evaluate(query); how can 'inject' contacts variable mono.csharp.evaluator evaluated part of query? going right way? in end either need resulting expression or iqueryable 'query' string. i think have few options: use static or threadstatic variables exchange data between caller , string based code: namespace myns { public class myclass { ...

entity framework 4 - Asp.Net mvc 2 , DropDownListFor and Editor Template . Selected Value dosen't work -

i have 2 views. productform.aspx , category.ascx. categoryform partial view. call category.ascx productform editorfor(model => model.category) . in partial view, there dropdownlistfor category. problem selected value specific product category. selected value dosen't work. why ? here have in productform <div class="editor"> <div class="editor-label"> <%: html.labelfor(model => model.productinfo.productname) %> </div> <div class="editor-field"> <%: html.textboxfor(model => model.productinfo.productname)%> <%: html.validationmessagefor(model => model.productinfo.productname)%> </div> </div> <%: html.editorfor(model => model.productinfo.category, new { categorylist = model.categorylist })%> in category.ascx <div class="editor-field"> <%:html.dropdownlistfor(model => model.categoryid, (ienumerabl...

uitabbar - UITabBarItem Selected Tab Background: Custom? -

would set custom background selected tabs, far, subclassing way i'm customizing uitabbar/uitabbaritem. the question is: know (or know find ) property sets background? there lighter black/grey rounded box around selected tab. i'm aiming @ changing. ios 4.1 ships game center, , they've customized uitabbar. i'm looking similar. in order achieve above going need create custom uitabbarcontroller class. customuitabbarcontroller.h #import <uikit/uikit.h> @interface customuitabbarcontroller: uitabbarcontroller { iboutlet uitabbar *tabbar1; } @property (nonatomic, retain) uitabbar *tabbar1; @end customuitabbarcontroller.m #import “customuitabbarcontroller.h” @implementation customuitabbarcontroller @synthesize tabbar1; - (void)viewdidload { [super viewdidload]; tabbar1.backgroundcolor = [uicolor clearcolor]; cgrect frame = cgrectmake(0, 0, 480, 49); uiview *v = [[uiview alloc] initwithframe:frame]; uiimage *i = [uiimage i...

sum and union all query using mysql and java -

i have table following fields service_type , consumer_feedback.for example: service_id consumer_feedback 31 1 32 -1 33 1 31 1 32 1. i want find sum of consumer_feedback each service_id through java code resultset res = st.executequery("select sum(consumer_feedback) consumer1 service_id=31 union select sum(consumer_feedback) consumer1 service_id=32 union select sum(consumer_feedback) consumer1 service_id=33") ; while (res.next()) { int c1 = res.getint(1); sum1 = sum1 + c1; } system.out.println("sum of column " +s...

File size in vb.net -

in form1 have textbox1, in textbox have location of file "c:\folder\file.iso" in form2 want file size of file in textbox1 tried this dim filedetail io.fileinfo filedetail = my.computer.filesystem.getfileinfo(form1.textbox1.text) label1.text = size: filedetail.length end sub i dont error, size of file isn't showed in label. edit: doesn't seem work private sub unscramble_load(byval sender system.object, byval e system.eventargs) handles mybase.load if system.io.file.exists(form1.textbox2.text) dim fi new system.io.fileinfo(form1.textbox2.text) label3.text = "size: " & fi.length.tostring() end if end sub it still doesn't give me size of file nor gives "size:" dim filedetail = my.computer.filesystem.getfileinfo(form1.textbox1.text) label1.text = "size : " & filedetail.length

f# - Splitting a list into list of lists based on predicate -

(i aware of this question , relates sequences, not problem here) given input (for example): let testlist = [ "*text1"; "*text2"; "text3"; "text4"; "*text5"; "*text6"; "*text7" ] let pred (s:string) = s.startswith("*") i able call myfunc pred testlist , output: [ ["*text1";"*text2"]; ["*text5";"*text6";"*text7"] ] this current solution, don't nested list.revs (ignore fact takes seq input) let shunt pred sq = let shunter (prevpick, acc) (pick, a) = match pick, prevpick | (true, true) -> (true, (a :: (list.hd acc)) :: (list.tl acc)) | (false, _) -> (false, acc) | (true, _) -> (true, [a] :: acc) sq |> seq.map (fun -> (pred a, a)) |> seq.fold shunter (false, []) |> snd |...

javascript - How can I resize an image, added via ajax, to fit within specific dimensions while maintaining aspect ratio using JQuery/CSS? -

i've got web application loads content external source dom via ajax call, 1 of things comes set of images (different sizes , aspect ratios) displayed in profile photo section. i'd each of images resized fit within 64px x 64px area , i'd maintain aspect ratio. able in firefox, chrome, , safari, i've no luck getting work in ie 7 or 8. problem i've had finding jquery event reliably gets triggered after image loads since image added after page load. here's works in listed browsers: $(window).load(function () { $('.profilethumbnail').each(function (i) { var divheight = $(this).height(); var divwidth = $(this).width(); if (divheight > divwidth) { $(this).css('height', '64px'); $(this).css('width', 'auto'); } else { $(this).css('height', 'auto'); $(this).css('width', ...

plsql - What would you expect an entry level pl/sql developer to know? -

i have interview coming entry level pl/sql developer job. took class in pl/sql have not done projects in pl/sql (other languages yes). know basic sql (joins subqueries etc), wondering more specific pl/sql information should know. i'd entry level position should have degree , have taken course or 2 on dbs. no experience necessary.

iphone - What does NSExpression *lhs, and NSExpression *rhs mean? -

i know nsexpression is, on place see these cryptographic variable names lhs , rhs. yes, can guess means leftfoo , rightfoo, "hs" stand for? no idea. "left-hand side" , "right-hand side". left-hand side on left of comparison operator, , right-hand side on right.

c# - Storing complex data in a list -

i'm working product called sitefinity. i have class looks so: public class categories { public icontent ocontent {get; set;} } i'm looping through list , trying check whether current value exists, so: ilist items = base.createdatasource(); ilist filteredlist = new list<string>(); foreach (icontent cnt in items) { if (!filteredlist.contains(cnt)) { filteredlist.add(cnt); } } return filteredlist; but returns error. using .contains correctly? update: ok have updated: list<icontent> filteredlist = new list<icontent>(); however, icontent has method can called extract further information, so: foreach(icontent cnt in items) { string strcat = cnt.getmetadata("category"); } now although want filteredlist contain multiple icontent items, want check against string getmetadata before deciding whether item should added. make sense? thanks. you cannot add icontent object list<string> ,...

powershell - How to determinate a CNAME on Windows? via Poweshell or others -

i want know if exists scriplet know local server cname, or via cmd, regedit, etc the hostname program/command should give dns name of local machine, whereas shell command echo %computername% should show netbios name (which might different).

go - How to force compiler to control value/pointer-to-value func arguments? -

dealing go's funcs discovered 1 can't force compiler control whether pass value or pointer-to-value argument when using 'generic' interface{} type. func f(o interface{}) { ... } the obvious solution use following modification: func f(o *interface{}) { ... } although compiled didn't find step right. so, there means state want pass pointer ? no. @ compile time, interface{} , empty interface, type. all types implement empty interface: interface{} interface types

How do C++ operators work -

given x = 2, y = 1, , z = 0, following statement display? printf("answer = %d\n", (x || !y && z)); it on quiz , got wrong, don't remember professor covering this, enlighten me please... know answer 1, why? the expression interpreted x || (!y &&z) (check out precedence of operators || , ! , && . || short-circuiting operator. if left operand true (in case of || ) right side operand need not evaluated. in case x true, being boolean expression result 1. edit . the order of evaluation of && , || guaranteed left right.

cocoa - How to register user defaults using NSUserDefaults without overwriting existing values? -

i have appdelegate class +(void)initialize method use register defaults. here's code use: + (void)initialize { nsdictionary *defaults = [nsdictionary dictionarywithobjectsandkeys:@"no", @"fookey", @"yes", @"barkey", nil]; [[nsuserdefaults standarduserdefaults] registerdefaults:defaults]; } i created preferences.xib holds couple of checkboxes ( nsbutton ) display status of preferences. bound nsuserdefaultscontroller same keys (fookey , barkey in case). each time launch app , change "defaults" restored on next app launch. is there way register "default defaults" without overwriting existing values? maybe each time build , launch app preferences file being recreated? maybe should unbind checkboxes nsuserdefaultscontroller , maintain values of keys myself custom code in preferences window controller? i'd hear implementation of choice maintaining user defaults. i'm using mac os x 10.6.2 , xcode 3.2...

asp.net - Crystal Reports (VS 2008) not printing Barcode Font on Server -

i have web application has report. export report pdf , send client. on report have field has font set non-standard windows font (i.e. barcode font). barcode font ttf font. on dev machine, installed font, printed report, barcode displayed. on server, have installed font, when printing it, seems have reverted arial font. this using version of crystal supplied vs2008. any ideas? i have un-installed , re-installed font... thanks in advance i've been in similar situation before myself: try opening fonts folder control panel , open font installed see default sample text. if looks good, try report again may magically work. i've had before when using older truetype barcode font on newer versions of windows. if doesn't work, try verifying report again, , save new file instead of overwriting existing one.

hibernate - Maintaining graph consistency in relationships with nHibernate -

if use bidirectional associations in nhibernate, necessary me add own code both sides of relationship automatically update other side? for example, if have many-to-one relationship between book , category public class book{ public category category{ get; set; } } public class category{ public ilist books{ get; set; } } do need add code book.category's set() this: private category _category; public category category { { return _category; } set { category priorcategory = _category; category newcategory = value; if( newcategory != priorcategory ) { if( priorcategory != null ) { _category = null; priorcategory.books.remove( ); } _category = newcategory; if( newcategory != null ) { newcategory.books.add( ); } } } } and also add code category.books callers can add , remove books category.books (e.g., category....

Zend Framework: How to generate javascript only once? -

i creating custom zend form element require javascript. can add javascript need this: /** * renders javascript view. */ protected function _generatejavascript() { $this->view->headscript()->capturestart(); ?> $(document).ready(function(){ alert('hello'); }); <?php $this->view->headscript()->captureend(); } however, if custom form element used multiple times, identical javascript appear multiple times. there way render javascript once? you might able like protected function _generatejavascript() { if (!isset($this->view->scriptgenerated)) { // generate script, then... $this->view->scriptgenerated = true; } } since php objects can have "extra" properties. you'll want pick better name, won't clash if have multiple scripts using same pattern. alternatively, have script in file. looks appendfile won't include script file more once. ...

c - Premptively getting files into Windows page cache -

i have program written in c allows user scroll through display of zillion small files. each file needs undergo amount of processing (read only) before it's displayed user. i've implemented buffer preprocesses files in radius around user's position, if they're working linearly through them, there's not delay. various reasons, can run processing algorithm on 1 file @ time (though can have multiple files open, , can read them) buffer loads sequentially. processing algorithms optimized they're going get, i'm running i/o problems. @ first, loading process slow, when files have been accessed few times, speeds 5x. therefore suspect what's slowing me down waiting windows page cache pull files memory. know little sort of thing. if ensure files in cache before processing algorithm needed them, i'd in business. my question is: there way persuade/cajole/trick/intimidate windows loading files page cache before around reading/processing them? ...

javascript - How do I switch external CSS files? -

i've got couple books i'm reading on ajax, still quite new. tutorials , these books have ubiquitous examples of: auto-populating search bar , asynchronous form validator. both great, not i'm looking for. specifically, want click button , switch external css file in header include. possible? well... know it's possible, how do it? ps: have jquery in project, if there built in there, better! pps: i'm realizing have not included important information (don't shoot me!): the final goal of have user settings section user can click radio button , decide color scheme want use our app. have 8 different css styles choose from. not sure if alter best method achieve this. the user logging account , changing setting there. want changes 'stick' until decide change stylesheet again. can manually in mysql have table called stylesheets various user stylesheets numbered... in actuality, i'm needing change mysql value asynchronously css loaded. sty...

c - Passing arrays vs structures to functions -

in c, arrays passed functions pointers. structures can passed functions either value or address (pointer). there specific reason why can not pass array value can pass structre value ? in c, everything passed value. there rule says in contexts, name of array equivalent pointer first element. passing array function such context. so, special case not arrays passed reference, special case the rule arrays decaying pointers . gives 1 impression array passed reference (which is, know why!) the post in link above explains in more detail type of array in different contexts.

c# - system.windows.forms.sendkeys.sendwait not working when window is maximize -

i sending keystrokes other running application using sendkeys.sendwait . not working if target application not minimize. wrong method? other methods send keystrokes running application. code block using: setforegroundwindow(handletoapplication); system.windows.forms.sendkeys.sendwait(keystroke); i suggest manipulating window prior sending keys it... private void setwindowstate(string windowtitle, int option) { /** sw_hide 0 sw_shownormal 1 sw_normal 1 sw_showminimized 2 sw_showmaximized 3 sw_maximize 3 sw_shownoactivate 4 sw_show 5 sw_minimize 6 sw_showminnoactive 7 sw_showna 8 sw_restore 9 sw_showdefault 10 sw_forceminimize 11 sw_max 11 **/ process[] plist = process.getprocesses(); intptr hand...

Download an Entire Website in C# -

forgive ignorance on subject i using string p="http://" + textbox2.text; string r= textbox3.text; system.net.webclient webclient=new system.net.webclient(); webclient.downloadfile(p,r); to download webpage. can please me enhancing code downloads entire website. tried using html screen scraping returns me href links of index.html files. how proceed ahead thanks scraping website lot of work, lot of corner cases. invoke wget instead. manual explains how use " recursive retrieval " options.

linux kernel - compile drivers as module or built-in problem -

i compiled linux kernel drivers built-in (all network drivers compiled built-in). things work ping time goes irregular (10ms , 90ms, ...). built-in mode in compilation or problem thing? it shouldn't change thing. irregular timeouts come either faulty drivers (but whether have them built-in or loaded dynamically shouldn't change anything) or faulty network.

Scope Guard in C -

i use scope guard in c in order profiling. i know how time spend in function. here do: int function() { tic(); ... stuff ... if (something) { toc(); return 0; } toc(); return 1; } i need place toc statement each time exit function. without having copy paste toc everywhere. there generic way that, using macro or ? don't want change way function called, there many functions have profile. thanks this doesn't change way function called. not use if want able profile every single function, though. static inline int real_function() { // previous contents of function(), no tic or toc } int function() { tic(); int r = real_function(); toc(); return r; } as else says: use profiler, save lot of effort in long run. don't say: if platform has one. if doesn't, easiest might (as coding rule) functions must have 1 exit point, , exit point must via macro. can manually instrument functions code @ entry , exit. lega...

audio - A clojure friendly library for playing sounds -

i'm looking easy program library infrequently playing sounds (notifications , like) clojure function. edit: this (use 'my.sound.lib') (play-file "filename") (beep-loudly) (bark-like-a-dog) ... ok, question including api wishlist... ;-) you can use jlayer mp3 playback on jvm. on ubuntu it's packaged libjlayer-java. there's simple example of use in java here . clojure wrapper: (defn play-file [filename & opts] (let [fis (java.io.fileinputstream. filename) bis (java.io.bufferedinputstream. fis) player (javazoom.jl.player.player. bis)] (if-let [synchronously (first opts)] (doto player (.play) (.close)) (.start (thread. #(doto player (.play) (.close))))))) use (play-file "/path/to/file.mp3") play mp3 fly in separate thread, (play-file "/path/to/file.mp3" true) if you'd prefer play on current thread instead. tweak liking. supply own loud beep , barking dog m...

tortoisesvn - How can I create SVN versioning on top of an existing project? -

at work we've got large project (approx. 30,000 files) managed borland starteam source control system. we'd migrate svn, there few hurdles in way. significant 1 problem of getting repository set on devs' vms. there 2 basic ways set new svn-versioned folder on hard drive. (on windows, using tortoisesvn.) can either check out svn project repository, or take existing code , upload (presumably empty) repository, , after either of these operations end folder tree svn metadata folders. have few dozen devs each have entire copy of project already. we'd upload once, , run sort of "associate existing folder repository @ [wherever] , synchronize them" operation. does svn support this? if so, how, , possible in tortoisesvn, or require other tools? what should work doing right-click "svn checkout..." on existing folder on hard drive contents identical repository check out. every file tortoise finds locally, compare version in repository f...

Java JSONObject does not maintaing the order of which I put things into. Trying to send into WCF service -

this weird issue. understand json supposed unordered , implementation of java.lang.jsonobject mentions unordered. however, puzzles me because expect way call put(); methods should keep order. maybe contradicts said in beginning though. i using json communicate wcf web service requires me include __type key designate type of complex object sending. i urge try this: jsonobject object = new jsonobject(); try { object.put("__type", "value1"); object.put("secondkey", "value2"); object.put("thirdkey", "value3"); } catch (jsonexception e) { e.printstacktrace(); } the output in log is: {"thirdkey":"value3","__type":"value1","secondkey":"value2"} now, understand implementation uses hashmap , order not maintained. when calling wcf service key __type required first deserialization occur on service. how can achieve this? so...

vbscript - How can I maximize, restore, or minimize a window with a vb script? -

i need able make separte .vbs files (when triggered keyboard short-cut) make active window maximized, minimized, or restored. how can without downloading , installing (not allowed here) separate package. vbscript , windows script host don't provide intrinsic functions maximizing/minimizing/restoring window. without third-party tools, option use sendkeys simulate keyboard shortcuts of corresponding commands in window's system menu. to maximixe active window, can simulate alt + spacebar , x shortcut: set oshell = createobject("wscript.shell") oshell.sendkeys "% x" to minimize active window, use alt + spacebar , n : set oshell = createobject("wscript.shell") oshell.sendkeys "% n" to restore active window, use alt + spacebar , r : set oshell = createobject("wscript.shell") oshell.sendkeys "% r" (note code won't work in non-english windows versions, names of maximize/minimize/restore comma...

Is a Java array of primitives stored in stack or heap? -

i have array declaration this: int a[]; here a array of primitive int type. array stored? stored on heap or stack? primitve type int , primitive types not stored on heap. as gurukulki said, it's stored on heap. however, post suggested misunderstanding due well-intentioned person propagating myth "primitives live on stack". untrue. local variables have values on stack, not primitive variables local... for example, consider this: public class foo { int value; } ... public void someothermethod() { foo f = new foo(); ... } now, f.value live? myth suggest it's on stack - it's part of new foo object, , lives on heap 1 . (note value of f reference, , lives on stack.) from there, it's easy step arrays. can think of array being lot of variables - new int[3] bit having class of form: public class arrayint3 { public readonly int length = 3; public int value0; public int value1; public int value2; } 1 in ...

How do I create a new file for each log4net logger instance? -

i trying create different log file each thread (the threads handling site processing). naming log file name derived site being processed. i know globalcontext.properties , theadcontext.properties , neither seem work trying do. in pretty either case concurrently running threads use whichever file current output file output. difference have seen if use threadcontext set property makes files outputs one, using global seems make 1 file unless processes start @ different times. what able tell file use name of logger object (the name used in instantiating object) in file name instead of using these properties. instead of fighting configuration, recommend rethink logging strategy. log4net not built log file per thread/class. loggers created @ startup or on first write (depends). use tailing log file reader, kiwi log viewer or splunk, , filter on thread id or logger name in messages. if put them in conversion pattern... <conversionpattern value="%date [%thread] ...

asp.net - Trying to build my .NET 3.5 mvc app in VS2010 Beta2 throws a MVCBuildView error -

i upgraded vs 2010 beta2. upgraded slns , csprojs when opened them. when asked me, opted stay in .net 3.5 keep compatability note: original project build mvc2 preview2 - exact same version comes vs2010 however, when try build web project including views, run compiler errors. i have pager.ascx paging magic using routevaluedictionary, error @ build time. error 50 type 'system.web.routing.routevaluedictionary' exists in both 'c:\program files\reference assemblies\microsoft\framework.netframework\v4.0\system.web.dll' , 'c:\windows\assembly\gac_msil\system.web.routing\3.5.0.0__31bf3856ad364e35\system.web.routing.dll' c:\projects\phase2\source\kk.web\views\shared\pager.ascx 8 kk.web mvcbuildviews true inside project file. how fix build error? i somehow need tell aspx compiler v3.5 (or v2.0, not sure). don't know how this. any appreciated. cv according this article need have change aspnetcompiler physical path so: <tar...

php - User schema for website -

i need create database schema storing user information (id, name, p/w, email address ...etc). have picked arbitrary amounts when sizing these fields. said, have 2 questions: 1) sizes these fields? sure there maximum email address length example...etc. 2) need store user mailing addresses credit card purchases, including international mailing addresses. area not want pick arbitrary sizes. does know of schema either? there project maybe? thanks! also consider db engine use , whether primary key email, rowid, or arbitrary number. typically save passwords on second table called "security" using hash suggested above. here's example. create table if not exists `users` ( `user_id` varchar(255) not null, `active` char(1) default 'y', `created_date` integer unsigned default 0, `email` varchar(255) default null, `first_name` varchar(255) default null, `last_name` varchar(255) default null, `modified_date` integer unsigned defaul...

javascript - settimeout is not working when Windows goes to sleep mode and then wake up -

i have noticed in chrome . has idea what's wrong or workaround ? you can use setinterval instead - keeps on running. if need one-shot solution, use clearinterval delete timer. setinterval fire if computer asleep while event should have been fired. tested behavior in chrome, firefox , internet explorer. example, have @ http://blaeul.de/de/content/javascript-timer-test , source.

datetime - GWT java.util.Date serialization bug -

gwt doesn't serialize java date properly. when tried sending date created in javascript through wire, found out dates between april 1st (funny) , 25th october years before year 1983 subtracted 1 day. that means that, say, both 1982-04-01 , 1982-03-31 become 1982-03-31 on java side. given dates in question, guess kind of dst problem. i've tried googling, , found one other reference describes similar problem. i tried submitting bug gwt team, curiously wasn't able find bugtracker gwt. so, questions are: anyone else run this? i'm on gwt 1.7, , confirm if happens on 2.0 well. my workaround send dates strings, , parse them on server. knows better workaround? assuming using java.util.date question 1: seems fixed in 2.0. i've created both dates above (1982-04-01 , 1982-03-31) , come through correctly server (both represent on server 1982-04-01 , 1982-03-31 respectively). setup is: gwt 2.0 java 1.6 osx 10.6.2 question 2: pass 'milliseco...

javascript - prefs.set, prefs.getString not working in google gadgets -

i initialising user prefs , setting , getting numeric prefs not seems able , set string prefs. prefs initialise not altered later on in gadget, int prefs are. i set user pref set actual value prefs.set("cpopup8_value",popup8_value); later in app value can changed but when accessing later still original default value popup8_value = prefs.getstring("cpopup8_value"); i have checked writing correct value seems case , have checked have not exceeded 2k limit. storing , retrieving integers works fine.

settings - Qt4 QSettings save enumeration value (for example Qt::CheckState) -

i wanna save state of qcheckbok in qsetting, can cast value int maybe exists more simple , proper method it? here code: qsetting setting; qt::checkstate checkstate; //... checkstate = (qt::checkstate)setting.value("checkstate", qt::unchecked).touint(); //... setting.setvalue("checkstate", (uint)checkstate); setting.sync(); firstly, try avoid c-style casts. example, replace following line: checkstate = (qt::checkstate)setting.value("checkstate", qt::unchecked).touint(); with this: checkstate = static_cast<qt::checkstate>(setting.value("checkstate", qt::unchecked).touint()); the line cast checkstate uint should changed. secondly, qsettings relies on qvariant setting , retrieving values. qvariant can expanded support additional types using q_declare_metatype macro. here's documentation: http://doc.trolltech.com/4.6/qmetatype.html#q_declare_metatype however, mechanism not appear work enumerations (when ca...

c++ - error: boost.fusion::for_each() and struct derived from boost.tuple -

on compilation code: struct any_type: boost::tuple<std::string, std::string, std::string> { ... }; struct functor { void operator()(const std::string& v) { std::cout << v << std::endl; } }; int main() { any_type type; boost::fusion::for_each(type, functor()); } get error: no type named 'category' in 'struct any_type' why? want inherit boost.tuple. inherit boost::fusion::tuple instead of boost::tuple . note: consider making void operator()(const std::string& v) const

design - What's the point of a logging facade? -

there bunch of different logging libraries choose from, each own set of quirks , advantages. (.net examples: log4net, system.diagnostics.tracesource, nlog, etc.) the natural inclination abstract away quirks , use logging facade. (examples: castle.services.logging , common.logging , simple logging facade ) way, if given logging framework you're using goes stale, or different 1 comes vogue, can swap out implementation , leave code untouched. but there multiple logging facades choose from. given answer many disparate logging implementations abstraction, why not use logging facade facade? if sounds ridiculous, makes more ridiculous original logging facade? makes 1 layer of abstraction on top of logging framework magic number? i speak perspective of using abstraction insulate application code particular logging framework. there other factors can affect one's choice of logging framework or one's choice of (and requirements for) abstraction. i have spent lot of...

web config - Where should connection strings be stored in a n-tier asp.net application -

folks, i have asp.net project pretty n-tier, namespace, need separate 3 projects: data layer, middle tier , front end. i doing because... a) seems right thing do, and b) having sorts of problems running unit tests asp.net hosted assemblies. anyway, question is, keep config info? right now, example, middle tier classes (which uses linq sql) automatically pull connection string information web.config when instantiating new data context. if data layer in project can/should using web.config configuration info? if so, how unit test, (typically in separate assembly) provide soch configuration info? thank time! we keep them in global "settings" file happens xml. file contains global settings, 1 of connection string pointing appropriate server username , password. then, when applications consume it, put specific catalog (database) need in connection string. we have version of file each operating environment (prod, dev, staging, etc). then, 2 setting...

osx - Python and Boost - Trying to run vPython and getting __doc__ is read only error -

this super urgent! need vpython working, can give me on way this? i'm running on mac os x python 2.6 , , downloaded vpython. upon installation installs boost libraries python. now, when try import vpython libraries ('visual'), following occurs: >>>import visual traceback (most recent call last): file "<stdin>", line 1, in <module> file "/library/frameworks/python.framework/versions/2.6/lib/python2.6/site-packages/visual/__init__.py", line 59, in <module> import cvisual attributeerror: 'boost.python.staticproperty' object attribute '__doc__' read-only after reading around i've found possibly serious bug, lack technical know-how implement (or indeed trust myself try , implement) of 'workarounds' posted on interweb. does know decent fix this? or walk me through (newbie style) how implement of fixes. i believe have installed latest boost libraries svn trunk, although (very unhelp...

activex - Why can't I register my COM DLLs? -

my application needs 2 com dlls registered. done automatically if user has necessary access rights, otherwise can done using regsvr32 . now on few workstations following happens: start cmd.exe administrator register first dll: success register second dll: failure (0x80004005, access denied) the first time error reported me, automatically responded: "of course doesn't work, need administrator privileges." needless say, felt pretty embarrassed tried register dll myself... what reason this: 1 dll can registered, other not. some background information: both dlls created delphi 2005. both dlls have simple interfaces , few classes. the failing machines vista or windows 7. normally i'd start process monitor, don't have access 1 of workstations right now, have gather information possible until can hands on 1 of them. update : remotely accessed 1 of failing workstations. mysterious things happened: starting process monitor not possible (!) a...

I have a sybase database in a file. How do I determine for which version of sybase it is for? -

i've been handed file appears me sybase database file older sybase version. have d-loaded latest sybase package sybase , tried using connect contents failed. can suggest me how determine version of sybase (and perhaps sybase db product) file represents? this how beggining of file looks in text editor: i ě ^şzÚ Ök n´Ą ÍĄ yŘ l f ˙˙˙˙˙˙˙˙ ˙˙˙˙˙˙˙˙watcom international corp., copyright (c) 1987, 1994 watcom international corp., copyright (c) 1987, 1994 watcom international corp., copyright (c) 1987, 1994 watcom international corp., copyright (c) 1987, 1994 watcom international corp., copyright (c) 1987, 1994 watcom international corp., copyright (c) 1987, 1994 watcom international corp., copyright (c) 1987, 1994 watcom international corp., copyright (c) 1987, 1994 watcom international corp., copyright (c) 1987, 1994 watcom international corp., copyright (c) 1987, 1994 watcom international corp., copyright (c) 1987, 1994 watcom internatio...