Posts

Showing posts from January, 2010

ruby - Creating categories on Jekyll driven site -

i'm having hard time understanding how generate archive pages each category use on blog. i'd user able click on category , taken page lists out articles desired category assigned. the way can think of doing manually creating specific html file each category in root. i'm sure there must more dynamic way? i have site hosted on github - https://github.com/sirbrad/sirbrad.github.com thanks in advance! brad you can generate list of available categories using site.categories data, using first element of each category (which array) category name: {% cat in site.categories %} <li>{{ cat[0] }}</li> {% endfor %} and can generate list of posts in given category so: {% post in site.categories.category_name %} it doesn't seem possible generate individual html page each category hoping, perhaps compromise generate single page containing list of categories, each category contains posts in category. use simple javascript hide posts in each

asp.net mvc 3 - unity mvc3 - configuring using database first approach -

Image
i´ve been checking microsot unity ioc , found examples using code first approach. on other hand cannot find tutorial or configuration in order include unity ioc edmx files using database first approach. glad in shed light on it. i tried using http://unitymvc3.codeplex.com/ , using unity 2.1 directly = http://unity.codeplex.com/ sorry cannot provide code i´m confused ioc patterns , not able generate demo solution. brgds. ioc turning of object inside out instead of containing internal hard references objects (dependencies), instead same objects passed outside. turning inside out inversion of control , , injecting of objects needs dependency injection , done container (unity). all ioc containers same, have way register or discover dependencies , way resolve reference. resolution involves asking reference of fooclass , getting object in return. don't ask concrete type fooclass , instead ask ifooclass decouple usage actual type gets passed in. so in case need r

hyperlink - FQL: stream table does not return others links -

i'm attempting posts of company page through fql query. normal posts others returned ok (posts containing text). posts company contains links returned ok. but: posts others company itself, contains link not returned stream table. does have idea why? my simple fql query: select post_id, type, actor_id, message stream source_id = 123 , updated_time >= 123 order updated_time limit 50 offset 0 you'll need links using fql query. use link table instead.

ios - iPhone app converted to iPad app shows iPhone xib not iPad xib -

i in process of converting iphone app universal app. i've changed xcode settings , added new mainwindow-ipad.xib i've hooked interface builder references (e.g. mainwindow-ipad appropriate ipad class viewcontroller, window etc) i've added new ipad class opening view controller , declared in appdelegate.h file, , synthesized them in appdelegate.m file: uiwindow *window; uiwindow *windowipad; appviewcontroller *viewcontroller; appviewcontrolleripad *viewcontrolleripad; in app delegate check device running , load appropriate class: if (ui_user_interface_idiom() == uiuserinterfaceidiompad) { // override point customization after application launch. navcontroller = [[uinavigationcontroller alloc] initwithrootviewcontroller:viewcontrolleripad]; // add view controller's view window , display. [windowipad addsubview:navcontroller.view]; [windowipad makekeyandvisible]; [navcontroller setnavigationbarhidden:yes animated:no]; } else {

java - How do I make a GUI looking like this? -

i need make gui looks 1 below have @ java tutorial . in particular, swing tutorial . need use jlabel , jbutton , jspinner jpanel organize them. if need in layout, try use matisse builder in netbeans. there similar in eclipse too.

javascript - Convert date string to date -

i have string mar 7 2012 . how convert date object, can use mydate.getdate() , mydate.getmonth() , mydate.getfullyear() etc? well, pretty simple var d =new date("march 7 2012"); document.write(d.getmonth()); //use

objective c - capitalizedString doesn't capitalize correctly words starting with numbers? -

i'm using nsstring method [mystring capitalizedstring], capitalize words of string. however capitalization doesn't work words starting numbers. i.e. 2nd chance becomes 2nd chance even if n not first letter of word. thanks you have roll own solution problem. apple docs state may not specified behavior using function multi-word strings , strings special characters. here's pretty crude solution nsstring *text = @"2nd place nothing"; // break string words separating on spaces. nsarray *words = [text componentsseparatedbystring:@" "]; // create new array hold capitalized versions. nsmutablearray *newwords = [[nsmutablearray alloc]init]; // want ignore words starting numbers. // class helps determine if string number. nsnumberformatter *num = [[nsnumberformatter alloc]init]; (nsstring *item in words) { nsstring *word = item; // if first letter of word not number (numberfromstring returns nil) if ([num numberfromstri

java - Eclipselink insert joined object with @OneToOne -

i have 2 objects: primary key a_id, , b primary key b_id. b has foreign key a_id. while @ database level means have multiple b objects point same a, relationship 1 one b. both a_id , b_id generated sequences. have following eclipselink annotations describe relationship: public class { ... @onetoone(mappedby = "a", fetch = fetchtype.lazy, cascade = cascadetype.all, targetentity = b.class) public b getb(); ... } public class b { ... @onetoone(fetch = fetchtype.lazy, targetentity = a.class) @joincolumn(name = "a_id") public geta(); ... } this doesn't work. if have object, b object set on it, , b object has same object set on it, b object not inserted, when a.getb() null. however, if change annotation on @onetomany so: public class { ... @onetomany(mappedby = "a", fetch = fetchtype.lazy, cascade = cascadetype.all, targetentity = b.class) public set<b> getb(); ... } with else same,

broadcastreceiver - How broadcast receiver works in Android -

i have question broadcastreceiver in android, say, system broadcast receiver boot_completed . if have written listener broadcast after system booted , installed it. how android system know has notify application, since application not running installed? that, broadcastreceiver derived classes in memory (or system loads them in memory after bootup) , whenever broadcast happens, relevant application can receive it. thanks braj when broadcast boot_completed sent, android system checks manifests of loaded apps see if meant handle message. same true implicit intents, , broadcasts. manifests public facing , allows system know app can , do.

Rails: determining whether to use SSL for url() in CSS -

suppose had file fonts.css.scss following: @font-face { font-family: 'play'; font-style: normal; font-weight: bold; src: local('play-bold'), url('http://themes.googleusercontent.com/static/fonts/play/v3/abigxw3ilixho08ckkyt9gluueptyoustqem5amljo4.woff') format('woff'); } if application requested via ssl, font file above still requested insecurely, many browsers don't , complain about. i tried renaming file font.css.erb , , trying use request.ssl? determine whether use http or https, apparently request undefined in assets. so, can change have font loaded on ssl if necessary? the problem css files in assets directory compiled static assets, need snippet of css dynamic. if that's url you're worried about, put view. if there's lots of url's referenced in css make 2 different css files, 1 https friendly , 1 not. dynamically decide file load view.

join - DJANGO: many-to-many relationship with additional fields -

new programming , confusing me... have 2 models. department , crossfunctionalproject. relationship between 2 models creates join table called department_crossfunctionalproject. i have model called employee. want add employees department_crossfunctionalproject table. how can this? i've been following tutorial: https://docs.djangoproject.com/en/dev/topics/db/models/#extra-fields-on-many-to-many-relationships . can not on automatically created department_crossfunctionalproject join table django creates? i keep getting following error: commanderror("one or more models did not validate:\n%s" % error_text) django.core.management.base.commanderror: 1 or more models did not validate: companydatabase.membership:"department_crossfunctionalproject" has relationship model <class 'companydatabase.models.department_crossfunctionalproject'>, has either not been installed or abstract. models: class crossfunctionalproject(models.model): nameof

assembly - How far can the j(jump) instruction jump in memory? (MIPS) -

consider j(jump) instruction in mips. how far can jump in memory? 32bits? can please have explanation. from this page , you'll see jump instruction has following effects: pc = npc; npc = (pc & 0xf0000000) | (target << 2); target 26 bit number. means j instruction can jump absolute address can created operation above. largest value target , therefore, 2 26 -1 (0x03ffffff), , highest reachable address (pc & 0xf0000000) | 0x0ffffffc .

objective c - How to convert a Python datetime.datetime.utctime() to an Obj-C NSDate, and back again? -

edit: basically, i'm looking this, in utc-time, ideally via iso-8601: python: datetime.datetime ---> iso-8601 string python: iso-8601 string ---> datetime.datetime obj-c: nsdate ---> iso-8601 nsstring obj-c: iso-8601 nsstring ---> nsdate this seems should simple, can't seem figure out. python code, converting string: >>> import datetime >>> datetime.datetime.utcnow().strftime("%y-%m-%d %h:%m:%s %z") '2012-03-08 00:07:31 ' note time-zone info %z printed empty string, since utcnow() returns naive datetime object. how turn aware 1 , print following? '2012-03-08 00:07:31 +0000' on obj-c side of things: // fails , prints (null) since timezone missing. nsstring *pythondate1 = @"2012-03-07 23:51:58 "; nsdate *objcdate1 = [nsdate datewithstring:pythondate1]; nslog(@"%@", objcdate1); // works, manually adding in "+0000". nsstring *pythondate2 = @"2012-03-07 23:51

objective c - How can I cancel and animation started with transitionFromView:toView:duration:options:completion? -

how can cancel , animation started transitionfromview:toview:duration:options:completion? want, avoid calling completation block if animation cancelled, because thatblock transitates state machine. i guess possible cancel animation because here: https://developer.apple.com/library/ios/#documentation/uikit/reference/uiview_class/uiview/uiview.html read this: completion block object executed when animation sequence ends. block has no return value , takes single boolean argument indicates whether or not animations finished before completion handler called. therfore, how can cancel animation? lot. it layer of fromview's superview animates in scenario. can cancel animation @ time with [parentview.layer removeallanimations]; your completion callback still called, keep in mind that, you've quoted above, callback takes bool argument indicating whether animation completed or not. check argument , nothing if it's no. visually, animation jumps end. you'll s

apache - apache2 httpd configuration -

my document root /var/www , have no virtual hosts enabled. folder structure of /var/www: index.php classes (external) controllers models files (img, js, css) views (pages, components) as can see using model view controller pattern. need correct configuration have use in httpd.conf define files folder can accesed , no other folder, prevent "not found" messages or direct php access. how can set up? this current httpd.conf serversignature off servertokens full # settings server @ port 80. <virtualhost *:80> servername <url> documentroot /var/www directoryindex index.php # no 1 has access main directory. <directory /> order deny,allow deny options none allowoverride none </directory> # configure main directory <directory /var/www> # has access main directory. order allow,deny allow options followsymlinks allowoverride none

Lighttpd server.use-noatime -

i using lighttpd server. on main page lighttpd.net saw io benchmark. , saw config-key: server.use-noatime = "enable" server.max-stat-threads = 2 server.max-read-threads = 64 but when put config-key lighttpd.conf , restart lighttpd error show: 2012-03-08 07:00:21: (server.c.968) warning: unknown config-key: server.use-noatime (ignored) 2012-03-08 07:00:21: (server.c.968) warning: unknown config-key: server.max-stat-threads (ignored) 2012-03-08 07:00:21: (server.c.968) warning: unknown config-key: server.max-read-threads (ignored) can me how use config-key? thanks those configs work in lighttpd 1.5.0 never officially released (you can find pre-release @ http://www.lighttpd.net/2007/2/3/lighttpd-1-5-0-pre you'll note dated 2007).

haskell - Parsec: Predictive parsing -

i have few skills haskell , need how implement predictive parsing (ll*) parsec. i have context free grammar: <a> ::= identifier | identifier '(' <args> ')' based on http://research.microsoft.com/en-us/um/people/daan/download/parsec/parsec.pdf (chapter predictive parsers) wrote code: term = do{ x <- m_identifier ; try( char '(' ) ; b <- argsparser ; char ')' ; return (fnccall x b) } <|> { x <- m_identifier ; return (varid x) } i expected code try match '(' , if not parser continue , match identifier. code works matching identifier '(' args ')'. with calling on identifier "a" throws: parse error @ (line 1, column 2): unexpected end of input expecting letter or digit or "(" all alternative part should under try , think: term = try( do{ x <- m_identifier ; char '(' ; b <- argsparser ; char ')'

javascript - Uncaught TypeError while generating a random position for the food in a HTML5 snake game -

i working on making multiplayer snake game in html5 canvas javascript. the code below function handles random placement of food snake. problem piece of code give me x , y in while(map[x][y]); can not read though generate random number. this exact error: "uncaught typeerror: cannot read property '20' of undefined" the '20' random generated number (and grid position of food in 2 dimensional array) , changes every time restart program or refresh webpage. can explain need change in order define x , y , place food? function rand_food(){ var x, y; { x = mr() * this.rect_w|0; y = mr() * this.rect_h|0; } while (map[x][y]); <-- here error map[x][y] = 1; this.ctx.strokerec

opengl es - Android external events related stutter -

i've been doing several opengl based games android recently, , there's 1 issue can't find way rid of. when system starts process in background (checking cdma status, updating app, or prerry else), game suffers whole second stutter. once in every few minutes. annoying issue, until started breakout-style game, wrecked stutter (the ball teleport right through bricks). it there way give game activity priority on background processes, or pause background updates , installs while game running? it there way give game activity priority on background processes the game activity has "priority on background processes", extent can. generally, background processes run in class limits cpu utilization. note android's performance in area has improved on years. symptoms feel expect android 1.5 device, example. or pause background updates , installs while game running? no, sorry.

transparency - Truly transparent gradient possible in Fireworks CS5? -

Image
does know if it's possible have gradient created using fireworks transparent @ bottom? i'm trying create gradient transparent @ bottom, can placed on top of image. far i'm aware, though opacity of bottom 0, still have select color bottom. makes top color blend (like below it's blending white). whenever image placed on dark image bottom transparent still white. hope makes sense. help. i achieve effect setting both color endpoints of gradient same color, adjusting opacity endpoint 0% (or whatever want). here's result: #666/100% #666/0% on left, #666/100% white/0% on right.

Why doesn't a XML attribute have a "parent" in .NET? -

so, i'm writing simple function remove xml node xml document. easiest way achieve this, far can tell, to: get reference node removed ( childnode ) get reference node's parent using childnode.parentnode property ( parentnode ) call parentnode.removechild(childnode) method now, works great if child node xmlelement , if child node xml attribute ? according msdn documentation xmlnode.parentnode , property return nothing , because " [attributes] not have parents. " attributes have "parents," not? attribute must assigned xml element, xml element attribute's parent, in mind. can clear misunderstanding, or clarify why .net framework not see attributes having parents? you can use xmlattribute.ownerelement owner of attribute. your procedure have modified this: get reference node removed ( childnode ). if type of node xmlattribute downcast type ( attributenode ) , reference node's parent using attributenode.ownerelement prop

tsql - SQL Server returns unexpected week number -

i have orders in table , last order date of 2011 20th dec. i'm using sql command calculate number of orders in given week: select convert(varchar(3),datename(week,convert(datetime,order_date,103))) week, count(1) orders order_table datename(year,convert(datetime,order_date,103)) = '2011' group convert(varchar(3),datename(week,convert(datetime,order_date,103))) order week asc it returns me of following results: week | orders 41 | 42 42 | 110 43 | 115 ... ... 51 | 155 52 | 15 the trouble is last order date of 2011 mentioned have 20th dec 2011, can't week 52 must week 51. i've got other stats(off system, not sql server) giving me other figures , last week on 51 have no doubt correct. there's going queries if people looking both! anyone have idea or know how sort this? thanks, the iso_week of 20th dec 2011 51. maybe need. select datepart(iso_week, '2011-12-20')

c++ - boost filesystem blocking calls? -

is there case following calls can block? e.g. due windows io conflicts (i.e. writing file simultaneously) or else? recursive_directory_iterator++ file_size last_write_time i have function using these reason intermittently has long execution time (might else, want make sure problem doesn't lie here).

c++ - ifstream a file which another program is writing to? -

what happens when try open file using std::ifstream while file being written application? that depends on sharing mode used open file in other program. if open mode use compatible sharing mode, you'll open file. otherwise, open fail. c++ doesn't offer "sharing modes," though, sharing modes whatever vendor's implementation happens use. if really want control on how open file, use os-provided functions ( createfile , in case). as writes other program take effect, you'll able read them in program. if write file, writes , other program's writes might interfere each other, causing data loss or jumbled output; don't that.

file io - Matlab Importdata -

i'm writing piece of code supposed import text files using importdata , count number of columns, thought cols() function suffice this, seems imported data stored double, meaning can't perform operation. m=importdata('title'); numcols=cols(m.data); am doing wrong? thought data fromthe text file stored in matrix/array? cols specific function use in database toolbox. you want use size function. eg: size(m.data,2); %returns number of columns fyi size(m.data, 1); %returns number of rows.

c# - Migradoc Image in paragraph line -

i have pdf cover page have 5 paragraph lines, , on 5 paragraph line need able add logo picture, looks : pragraph 1 first part of picture pragraph 2 second part of picture pragraph 3 third part of picture pragraph 4 fourth part of picture pragraph 5 fifth part of picture any ideas? right if create 5 lines , put picture wrapperformat set through ends on or under paragraph lines. simply set right margins of paragraphs keep text , image apart. with wrapformat == through, images ignored while laying out text - that's design. it's set paragraph margins keep text , images separated if that's want. you can set margin paragraph (as shown below) or better create style , assign style paragraphs on frontpage: paragraph paragraph = section.addparagr

sql server 2008 - SQL code to download a file from an FTP -

does have way can download file ftp using sql server 2008 (don't want use ssis)? is there better way using sql? if have xp_cmdshell access can use http://www.nigelrivett.net/ftp/s_ftp_getfile.html

Android - Find a contact by display name -

i'm trying find contact display name. goal open contact , add more data (specifically more phone numbers), i'm struggling find contact want update. this code i'm using: public static string findcontact(context context) { contentresolver contentresolver = context.getcontentresolver(); uri uri = contactscontract.commondatakinds.phone.content_filter_uri; string[] projection = new string[] { phonelookup._id }; string selection = contactscontract.commondatakinds.phone.display_name + " = ?"; string[] selectionarguments = { "john johnson" }; cursor cursor = contentresolver.query(uri, projection, selection, selectionarguments, null); if (cursor != null) { while (cursor.movetonext()) { return cursor.getstring(0); } } return "john johnson not found"; } i have contact called "john johnson", method returns "not found". tried searching contact 1 name, makes n

swing - ActionListener not working Java -

what missing here? public class abc extends jframe { private jbutton save = new jbutton("save"); public abc() { jpanel p = new jpanel(); save.addactionlistener(new savel()); p.add(save); container cp = getcontentpane(); p = new jpanel(); p.setlayout(new gridlayout(2, 1)); cp.add(p, borderlayout.north); } } class savel implements actionlistener { public void actionperformed(actionevent e) { system.out.println("hello"); // nothing happens } } why doesn't actionlistener work here you creating jpanel , adding jbutton it, creating new jpanel , adding panel jframe . need adding original panel content pane.

iphone - How to make the UIKeyboard black? -

Image
i've seen question here: can tint (black) uikeyboard? if so, how? , top answer suggests can hack around doing may app rejected apple. must not true, i've seen other iphone applications (a major 1 being clear) have black uikeyboard. how done? here's screenshot of clear reference: try out [(uitextfield *)mysubview setkeyboardappearance:uikeyboardappearancealert]; or adding setkeyboardappearance:uikeyboardappearancealert appropriately depending on how have set up!

ruby on rails - How to rake database to Heroku on cloud9 -

i'm noobie heroku, github , ror, week i'm stumbling through it. i have db on git , i'd clone , push heroku app via cloud9 (i'm working on chromebook) i can't use commands in c9 terminal: heroku run rake db:migrate heroku restart tl;dr: how migrate git db heroku app's database cloud9? oh, , also: if i'm using wrong terminology, let me know how bad of person , correct me. whilst cloud9 supports git deployments can't run commands need via console manage application. need use heroku gem locally manage application isn't going possible on chrome book. best option use use vps server somewhere can ssh (assuming that's possible) work via.

arrays in Ruby, how to handle this situation? -

let's have following array: arr = ["", "2121", "8", "mystring"] i want return false in case array contains non-digit symbols. if empty strings allowed: def contains_non_digit(array) !array.select {|s| s =~ /^.*[^0-9].*$/}.empty? end explanation: filters array strings match regular expression. regex true string contains @ least 1 non-digit character. if resulting array empty, array contains no non-digit strings. finally, need negate result, because want know array does contain non-digit strings.

c - ntohl used on sin_port and get negative nubmers -

i try print client port in server application in c. negative numbers of client port, strange behaviour:-/ 1 have idea problem? part of code cause problem: struct sockaddr_in client_address; int chosenport = (int) ntohl(client_address.sin_port); pritf("client port %d, chosenport"); i port -2121400320. use ntohs() instead - sin_port 16-bit value.

Vi, replace text -

i have text this template template template_results template and need replace this template_form template_form template_results template_form how can replace every match of template not followed _ character in vi? i tried this :%s/template[^_]/template_form - pattern not found :%s/template\[^_]/template_form - pattern not found :%s/template[_]/template_form - works, pattern opposite of need thank :) use negative lookahead: :%s/template\(_\)\@!/template_form/gc this means match "template" not followed ( \@! ) "_" see: :help /zero-width

How to get all rdf file about berlin from dbpedia -

in page: http://thedatahub.org/dataset/dbpedia can find information dbpedia such sparql endpoint , on. , how should ask rdf file mention berlin ? to everything related berlin in rdf you'll have write own sparql (construct) query including regexs, triples directly featuring resource : http://dbpedia.org/resource/berlin you can go url (which redirect http://dbpedia.org/page/berlin about berlin) , @ bottom of page links data in various formats. ps. ok, here's select version grabbing mentions of text "berlin" : select distinct ?s ?p ?o { ?s ?p ?o . filter regex(?o, 'berlin', 'i') } that may produce many results/time out, might want replace ?p known property (like abstract, not sure dbpedia term is). output rdf you'd tweak shape: construct { ?s ?p ?o } { ?s ?p ?o . filter regex(?o, 'berlin', 'i') }

magento change top links hellowired theme -

i new magento.i have used hellowired theme of magento 1.6. in theme @ top of page there top links account, cart etc. how change toplinks in hellowired theme of magento? search top.links inside of whole .xml files reside in layout directory. see xml nodes related different link. instance, in customer.xml , there "my account" section.

.net - Reallocating matrix from unmanaged to managed -

i've been trying piece of code working reallocate huge unmanaged matrix structure (namely std::vector<std::vector<t> > ) equivalent managed structure( cli::array<t,2> ). can't hold both structures in memory @ once opted write file , read structure back. problem once delete original matrix, , hence memory trying allocate managed memory matrix fails. i image might have heaps of different runtimes cpp vs clr. can't find specific details. possible cpp runtime keeping heap space, prevents clr heap allocate matrix back? if so, possible force cpp runtime clean heap space in order make room clr heap. now clarify, destination matrix has bidimensional array, not jagged array. know has problem can't resized. otherwise might able move matrix smaller chunks. thanks, in advance. if can't have both in memory @ same time, guess array more gigabyte in size. if want put in managed rectangular (non-jagged) array, clr have find gigabyte of contiguo

jquery - Javascript framework for GUI eye candy -

of major javascript frameworks (jquery, mootools, dojo, prototype etc), suitable build graphics-intensive online editor? is, application have in mind have little text, instead feature drag-droppable widgets, realtime animation, , cute effects. manipulating dom of little interest. maintaining relationship between gui elements , server-side (django) data crucial. i hope don't fall afoul of so's anti-shopping laws, it's difficult find comparisons specific purposes. my under-researched impressions far: jquery dom-manipulation toolkit, has pretty gui stuff too mootools more generic enhancement javascript, has "more" gives transitations , such, perhaps not full blown widgets? scriptaculous puts eggs in eye candy basket, no idea how stacks otherwise ember.js said generational improvement in client side gui frameworks (with ui bindings etc), under-documented. i guess don't yet know enough kind of development make sensible decision between them, though

python - Add count value to set -

i'm using django-taggit tag items in todo list app. i'm trying list each of tags along number of actions associated each tag may read: tag (1) tag b (3) tag c (2) tag has 1 item, tag b has 3, etc. i added boolean field django-taggit. i'm getting list of tags this: visible_tags = tag.objects.filter(visible=true).order_by('name') hidden_tags = tag.objects.filter(visible=false).order_by('name') i can count of items (actions) this: for tag in visible_tags: print tag print action.objects.filter(tags__name__in=[tag]).count() now want attach these counts visible_tags , hidden_tags set can iterate on them in template this: {% tag in visible_tags %} {{ tag }} ({{ tag.count }})<br> {% endfor %} how can attach .count value each tag within visible_tags , within hidden_tags? assume have iterate on tags in each set? use annotations: https://docs.djangoproject.com/en/dev/topics/db/aggregation/ from django.db.models i

sql server - Avoiding cursors to update many records using a trigger -

i have table on 1 million records. initially, table empty, use bulk insert add these records database. have after insert trigger use update initialvalue field in table. value of initialvalue calculation of specific variables in table ( my_data_db ) summed across records. using values of v1 , v2 , etc. columns column names in table my_data_db . i know it's poor practice, way know how calculation of every single row using cursor. million records really, slow. here's example of table have trigger on: table: test3 rowid v1 v2 v3 combo initialvalue 1 null m170_3 m170_4 c null 2 m170_2 m170_3 m170_4 abc null 3 m170_2 m170_3 null ab null ... my trigger is: create trigger [dbo].[trig_update_test3] on [dbo].[test3] after insert begin declare @sql varchar(max) declare @v1 varchar(20) declare @v2 varchar(20) declare @v3 varchar(20) declare @combo varchar(30) declare mycursor cursor

osx - is Flash plugin in WebView on Mac different from Flash plugin in Safari? does it have regular Flash garbage collection? -

an answer here opening swf files using webkit framework says following running swf movies inside webview inside cocoa application: "because flash plug-in not garbage-collection supported, plug-in won't work if application uses garbage collection". meanwhile, answer here flash as3 animation in mac vs windows discusses flash garbage collection on mac (likely in safari) , says sucks exist. so first claim no garbage collection in webview false or webview plugin distinct safari plugin? you confusing 2 types of garbage collection. first answer link talking objective-c garbage collection. enabled if compile app garbage-collected app. not default , apple recommends use arc instead of garbage collection. the flash plug-in not compiled using objective-c garbage collection, won't load in app uses objective-c garbage collection because garbage-collected apps link against different runtime. your second link discussing garbage collection in swf runtime of fl

javascript - Trouble with returning a correct element ID -

i've got 3 links serve sorting headings table, each member of "sort" class. wrote simple jquery function gets triggered when "sort" class link clicked. there's switch case assigns column number (columnnum) used tablesorter plugin. however, right i'm getting weird values returned id of sort classes. $(".sort").toggle(function() { // column id's datecaption, hourscaption, taskcaption var column = $(this).attr('id'); var columnnum; switch(column){ case 'datecaption': columnnum = 1; break; case 'hourscaption': columnnum = 2; break; case 'taskcaption': columnnum = 3; break; default: break; } var sorting = [[columnnum,1]]; $("#task_table").trigger("sorton",[sorting]); return false; }, function(){ var sorting = [[columnnum,0]]; $(

javascript - Detecting when user touches a link -

i'm trying detect when user has touched link within web page versus when have touched other part of page, not working - happens in following code alert "touched non link" pops wherever touch, regardless of if link. what there problem code? function addlisteners() { alert('adding listeners'); // attach listener touches on non-links document node document.addeventlistener("touchstart", touchesonnonlinkslisterner, false); // attach listener touches on links anchor nodes var links = document.getelementsbytagname("a"); (var index = 0; index < links.length; ++index) { links[index].addeventlistener("touchstart", touchesonnonlinkslisterner, false); } }; function touchesonnonlinkslisterner(event) // catches touches anywhere in document { alert("touched non link"); } function touchesonlinkslistener(event) // listens touches occur on links, prevents touch events bubbling tr

java - what happens to objects once application terminates -

in java when have application running in appserver glassfish, application deployed ejb. when undeploy ejb happens to sigletone classes loaded memory. understand until restart container present there , can garbage collected not sure , when happen, if deploy ejb once again may pick old objects jvm, ? each deployed app loaded own separate classloader. since classloader part of class's identity, same class can loaded multiple times (with different configuration) without different instances interfering each other. this isolates different applications within app server each other , allows same application run twice in parallel. when application undeployed, objects (including classloader , classes themselves) garbage collected, if no references them remain. unfortunately, can happen references remain in system class , prevent garbage collection - called classloader leak .

c# - Can't use System.Windows.Forms -

i have tried making (my first) c# program: using system; using system.collections.generic; using system.linq; using system.text; namespace consoleapplication1 { class program { static void main(string[] args) { console.writeline("hello"); console.readline(); } } } this goes well, if try using system.windows.forms: using system; using system.collections.generic; using system.linq; using system.text; using system.windows.forms; namespace consoleapplication1 { class program { static void main(string[] args) { console.writeline("hello"); system.messagebox("hello"); console.readline(); } } } this error get: error 1 type or namespace name 'windows' not exist in namespace 'system' (are missing assembly reference?) c:\users\ramy\documents\visual studio 2010\projects\consoleapplication1\consolea

wpfdatagrid - Subclass binding in wpf to datagrid column -

i have class of following details: public class contact public prime contactprime end class public class contactprime property conid string property conname string property company string property jobtitle string property contactno string property addr string property type string end class i have datagrid , item source set contactlist(of contact), question how can display prime.conname. additional info: following current databinding in datagrid: <datagrid autogeneratecolumns="false" name="datagrid1" margin="0,10,0,0" height="500" width="695" horizontalscrollbarvisibility="auto" verticalscrollbarvisibility="visible" selectionmode="single" isreadonly="true" > <datagrid.columns> <datagridtextcolumn binding="{binding conname}" header="name" width="150&

android - how to fill the remaining screen with table -

Image
i have following layout in application ok, quit buttons not there. now want distribute space after textview , table of 3 rows having 0-9,c, d buttons. want 3 rows span remaining space equally. please tell me how it. posting xml code. <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/main_layout" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_gravity="center_vertical" > <edittext android:id="@+id/textview1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_margintop="10dp" android:focusable="false" android:focusableintouchmode="false" android:inputtype="text" android:maxlength="100" /> <tablelayout android:i

pass a variable from PHP to JavaScript -

this question has answer here: how pass variables , data php javascript? 17 answers i using json string pass variable in javascript php : while( $row = mysql_fetch_array($result) ) { $tmp = array('id'=>$row['id'], 'alert_type_id'=>$row['alert_type_id'], 'deviation'=>$row['deviation'], 'threshold_low'=>$row['threshold_low'], 'threshold_high'=>$row['threshold_high']) ; $settings[] = $tmp ; } echo '{"data":'.json_encode($settings).'}' ; in javascript, using following snippet : console.log( result ) ; var json = eval('('+ result +')') ; and appears in console following error : 1{"data":[{"id":"1","alert_type_id":&qu

Python 3 equivalence of find() -

i've converted python 2 program python 3, in following code: te=find(p,']') i'm getting following error: nameerror: global name 'find' not defined i'm assuming find function not built-in in python 3? equivalence of code in python 3? please me out , thank in advance. that code doesn't work python 2. are looking p.find("]") ?

recreate .idea/workspace.yml in RubyMine -

i have file conflict co-worker in .idea/workspace.yml. mistakenly deleted version, , ubuntu version of file not compatible in osx. is there way recreate .idea/workspace.yml rubymine ide without resorting git original version? thank you. you can use local history feature restore files inside rubymine. note file should excluded version control .

Reading Input File and Putting It Into An Array with Space Delimiter in Perl -

i trying take input file @argv array , write it's elements array delimiter space in perl. sample input parameter txt file example: 0145 2145 4578 47896 45 78841 1249 24873 (there multiple of lines here not shown) problem is: i not know how take example arg[0] array i want take every string of inputfile single strings in other words line1 0145 2145 not string 2 distinct string delimiting space. i think want. @resultarray in code end holding list of digits. if you're giving program file name use input command line, take off argv array , open filehandle: my $filename = $argv[0]; open(my $filehandle, '<', $filename) or die "could not open $filename\n"; once have filehandle can loop on each line of file using while loop. chomp takes new line character off end of each line. use split split each line based on whitespace. returns array ( @linearray in code) containing list of numbers within line. push line array on end of @result

linux - expect + how to identify if expect break because time out? -

the target of following simple expect script hostname name on remote machine sometimes expect script fail perform ssh $ip_address ( because remote machine not active , etc ) so in case expect script break after 10 second (timeout 10) , ok but...... there 2 options expect script perform ssh , , performed command hostname on remote machine expect script break because timeout 10 seconds on both cases expect exit in case of ssh expect break after 0.5-1 second in case of bad ssh break after 10 seconds but don’t know if expect script perform ssh or not? is possible identify timeout process ? or verify expect ended because timeout? remark linux machine version - red-hat 5.1 expect script [testlinux]# get_host_name_on_remote_machine=`cat << eof > set timeout 10 > spawn ssh $ip_address > expect { > ")?" { send "yes\r" ; exp_continue } > > word:

php - Direct access after authentication insteed iframe access -

when user authorize app, redirected site , not facebook app in iframe. there way stay in facebook ? code : require './src/facebook.php'; $config = array(); $config['appid'] = 'xxxxx'; $config['secret'] = 'xxxxx'; $config['fileupload'] = false; // optional $facebook = new facebook($config); $user = $facebook->getuser(); if ($user) { try { // proceed knowing have logged in user who's authenticated. $user_profile = $facebook->api('/me'); } catch (facebookapiexception $e) { error_log($e); $user = null; } } // login or logout url needed depending on current user state. if ($user) { echo "blah"; } else { $params = array( 'scope' => 'read_stream, friends_likes', 'redirect_uri' => 'https://xxxxx' ); $loginurl = $facebook->getloginurl($params); echo("<script> top.location.href='" . $loginurl . &q

Dataintegrity between tables in SQL Server -

is possible add data integrity between columns in different tables in sql server? have table pay column date , table orders column dateoforder . , add data integrity date cannot earlier dateoforder . , when user insert there same date or earlier database show error. i think mean this, here done trigger; create trigger trig_pay on pay insert, update if exists(select * [order] o join inserted on o.id = i.payment_id dateoforder>[date]) begin raiserror ('sorry, dave', 16, 1) rollback; return; end insert [order] values (1, getdate()); -- order today insert pay values (1, dateadd(dd, -1, getdate())); -- pay yesterday > sorry, dave

osx - Mac vs PC Text Encoding -

i've noticed different itunes when export music library. i have song é (that is, small latin e acute accent) , when export library in windows, gets encoded @ %c3%a9, when export library mac, normal 'e' printed, followed %cc%81. example: song name: héllo world windows export: h%c3%a9llo world mac export: he%cc%81llo world this important me program i'm making where, in windows version, decode encoding, doesn't work if file comes mac. so why there difference? there place can see differences , see mac encodings are? there maybe object-c routine decode these strings? thanks. c3a9 utf-8 encoding character é. cc81 utf-8 encoding combining acute accent character (u+0301). an "e" followed combining acute accent combines character "é". 2 different forms of unicode normalization . why 1 itunes prefers 1 on other don't know, there's no inherent reason so.

math - Mapping a 2D space of 3D volumes to 1D space (a file) -

i have 2 dimensional array of 3 dimensional volumes. 2 dimensional array represents top-down view of of 3 dimensional volumes. i want save data file in such way can retrieve quickly. problem 2 dimensional array may change size , shape; it's not nice , square. tends leave unused sections , quite lot of them. my method of retrieval using volume-level 2d view locate volumes need loaded, having difficulty coming data structure , storage technique. of methods have come across require 2d view of same length , width or depend on length or width. it may worthy note want avoid unused space in file , want locality mapped points. when mapping points, pretty common come solution works produces odd relationships; {0, 0} must not map {0} , {1, 0} should pretty close {0} , not {34}. how go doing in space , time efficient manner? i solved while implementing few different space filling curves , using them map , transform upper dimensional data single dimension file. found hilbe

c# 4.0 - How to cancel a task or terminate the task execution instantly? -

i have windows service developed in c#. on it's start method have initialization such as: task _backgroundtask = null; cancellationtokensource _backgroundcancellationsource = null; protected override void onstart(string[] args) { ...... _backgroundcancellationsource = new cancellationtokensource(); cancellationtoken token = backgroundcancellationsource.token; _backgroundtask = new task(() => backgroundfoldersprocessing(token), token, taskcreationoptions.longrunning); ....... } now method backgroundfoldersprocessing looks this: void backgroundfoldersprocessing(cancellationtoken token) { while (true) { try { if (token.iscancellationrequested) { return; } dosomework() } catch (exception ex) { .........

html - Strange margin on `display:inline-block`-elements -

i have 6 div s display:inline-block in 1 line. have strange white space between each other, how can rid of that? should fit in container in 1 line. fiddle: http://jsfiddle.net/y7l7q/ html: <div id="container"> <div class="box"></div> <div class="box"></div> <div class="box"></div> <div class="box"></div> <div class="box"></div> <div class="box"></div> </div> css: #container{ width:300px; border:1px solid black; } .box{ display:inline-block; height:50px; width:50px; background-color:black; margin:0; padding:0; } write font-size:0; . this: #container{ width:300px; border:1px solid black; font-size:0; } check http://jsfiddle.net/y7l7q/1/ or write mark this: <div id="container"> <div class="box"></di

html - UL overlap, float:left image -

Image
possible duplicate: why list item bullets overlap floating elements i've been having problem ul's next floating image here code i've been using <img src="abc.jpg" width="300" height="375" style="float:left;" /> hello world isn't amazing <ul> <li>one</li> <li>two</li> <li>three</li> <li>four</li> <li>five</li> <li>six</li> <!--list shortened readability--> </ul> <p>extra sample text here</p> result if it's changed to <ul style="overflow:auto;"> the list carries on past image, not want also trying below gives wrong result <ul style="list-style-position: inside;"> photoshop of want while using list-style-position: inside on , remove padding-left of . padding defined browser. alternative, leave list-style-position: outside , in

iphone - Why am I getting this "libxml/tree.h file not found" error? -

i installed xcode version 4.3.1 , error: libxml / tree.h file not found i have installed xcode 4.2, , same project same error. i have configured header search paths /usr/include/libxml2 tried $(sdkroot) / usr/include/libxml2 , didn't work. i have put other linker flag lxml2 include following in header search path , should immune weirdness apple xcode updates: $(sdkroot)/usr/include/libxml2

c++ - VS 2010 build issue : reference issue -

i have solution multiple projects. few common folders bin/lib/include e.g. exported lib in lib folder, executable in bin folder , header in include example solution - s project a1 - dll project a2 - exe ... project an project a2 dependent on proj a1 i have build complete solution , deleted except sdk(bin\lib\include) folder. because big solution utilize exported sdk , build application now have taken complete code (a1, a2, ... an) , opened project a2, but when build gives me following error cannot open input file 'c:\code\development\src\a2\debug7\a1.lib' why not picking library common lib folder. it working fine in vs 2008, after upgrade 2010 never worked. my guess might still have code version of a1 in references folder of a2 project. it's check, in case.

matlab - cumsum only within groups? -

lets have 2 vectors: a=[0 1 0 1 1 0 1 0 0 0 1 1 1]; b=[1 1 1 1 1 1 2 2 2 3 3 3 3]; for every group of numbers in b want cumsum, result should that: c=[1 3;2 1;3 3] that means have ones in b 3 ones in a, group 2 in b have 1 one in etc. if you're looking solution b can anything, combination of hist , unique help: num = unique(b(logical(a))); %# identify numbers in b non-zero counts cts = hist(b(logical(a)),num); %# count c = [num(:),cts(:)]; %# combine. if want first column of c go 1 maximum of b , can rewrite first line num=1:max(b) , , you'll rows in c counts zero.

simplexml - HTTP request failed when using Twitter API with simplexml_load_file -

i want display 5 last tweet of twitter account in list if(($xml = simplexml_load_file('http://api.twitter.com/1/statuses/user_timeline.xml?count=5&screen_name=les_sismo')) !== false) { $tweets = $xml->xpath("/statuses/status"); foreach($tweets $tweet) { $text = $tweet->text; echo '<li>' . $text . '</li>'; } } else echo 'error'; and got 2 warning warning: simplexml_load_file(http://api.twitter.com/1/statuses/user_timeline.xml?count=5&screen_name=les_sismo) [function.simplexml-load-file]: failed open stream: http request failed! http/1.0 400 bad request in /homez.466/sismodes/www/wp-content/themes/sismo/header.php on line 89 warning: simplexml_load_file() [function.simplexml-load-file]: i/o warning : failed load external entity "http://api.twitter.com/1/statuses/user_timeline.xml?count=5&screen_name=les_sismo" in /homez.466/sismodes/www/wp-content/themes/sismo/he

Android VideoView, need to switch between videos quickly -

hello android developers! i'm developing new app , using videoview display mpeg clips. i need switch between videos quickly, however, loading new clip videoview seems take half second of black screen. the transition must seamless, how go solving kind of problem? thanks in advance, rotem i had similar issue , resolved still-image (imageview) transition: build framelayout imageview on videoview the imageview shows first frame of video initially imageview visible start video, wait arbitrary time (e.g. 2-300ms) hide imageview to switch 2 videos: - show image - switch video - hide image a bit hackish worked me

html in javascript confirm box? -

is possible insert html code in javascript confirm box? i tried & not seem work (i try add html link), see code below <html> <head> <script type="text/javascript"> function show_alert() { confirm(<a href="www.url.com">link text</a>); } </script> </head> <body> <input type="button" onclick="show_alert()" value="show alert box" /> </body> </html> i suspect might have use library such "jquery-ui's dialog" working you can insert plaintext alert(), confirm() , prompt() boxes.

dataimporthandler - Solr loading information without data import handler -

i have 700.000 street names, 8111 municipality names, , 80333 locality postcodes. index information in solr. user wants search information through ajax autocomplete form. have proved few data , behavoir of ajax autocomplete form it's ok. <fieldtype name="text" class="solr.textfield" positionincrementgap="100"> <analyzer type="index"> <tokenizer class="solr.whitespacetokenizerfactory"/> <filter class="solr.stopfilterfactory" ignorecase="true" words="stopwords.txt" enablepositionincrements="true" /> <filter class="solr.worddelimiterfilterfactory" generatewordparts="1" generatenumberparts="1" catenatewords="1" catenatenumbers="1" catenateall="0" splitoncasechange="1"/> <filter class="solr.lowercasefilterfactory"/