Posts

Showing posts from June, 2012

MYSQL GROUP BY 2 Tables -

i have 2 tables: games softwares and have rows: games: id | ref_id | title 1 | 20 | nikita 1 | 18 | simba softwares: id | ref_id | title 1 | 18 | adware 1 | 19 | acdsee now want group ref_id , get: 20 18 19 select ref_id games union select ref_id softwares this answer according result needed , table structure have mention.

AJAX/PHP/Jquery Issue with callback -

i can't seem figure out why won't work. have stripped elements out , have striped done base example. can please tell me doing wrong. when click on button on html page initial alert, never alert call backs. here code html file. test.html <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>untitled document</title> <script src="http://code.jquery.com/jquery-1.5.js"></script> <script language="javascript" type="text/javascript"> $(document).ready(function() { $("#test").click(function() { alert("!st"); $.ajax({ type : 'post', url : 'test_ajax.php', datatype : 'json...

c# - Parallel.For, max threads and cores -

on our server, got quad-core processor. when running parallel.for loop without paralleloptions parameter, how many threads utilize? also, when running nested loops, should both outer , inner loops parallel or outer in terms of performance? you can't know how many exactly, number of threads between 1 , n , n number of tasks run in parallel (one thread current thread of execution way, since parallel waits tasks complete). parallel not guarantee operations run concurrently however, may be. implement own task scheduler , use if want control on how many threads used. if want know whether better run outer , inner loops in parallel, there no answer. don't know loops doing. use performance analyzer before trying optimize loops, since odds have no idea performance bottlenecks are.

How to create and use CView inherited objects inside a frame in MFC? -

i created mfc sdi application without document/view using wizard in vs2008. want replace default created child control of cchildview splitter 2 ceditviews. creation works, application crashes when input character edit view. why crash occur? how fix crash? how access instances of created views? mainframe.h: class mainframe : public cframewnd { public: virtual bool oncreateclient(lpcreatestruct lpcs, ccreatecontext* pcontext); private: csplitterwnd splitter; // ... }; mainframe.cpp bool mainframe::oncreateclient(lpcreatestruct lpcs, ccreatecontext* pcontext) { splitter.createstatic(this, 1, 2); splitter.createview(0, 0, runtime_class(ceditview), csize(0, 0), pcontext); splitter.createview(0, 1, runtime_class(ceditview), csize(0, 0), pcontext); return true; } this article looks example of replacing default sdi view: http://simplesamples.info/mfc/withouttemplates.php

I cannot get a precise CMTime for Generating Still Image from 1.8 second Video -

every time try generate still frame video asset, generated @ time of 0.000.. seconds. can see log message. thing can image @ time 0.000.. show in uiimageview called "myimageview." thought problem avurlassetpreferprecisedurationandtimingkey not set, after figured out how that, still not function.. here have.. time, actualtime, , generate declared in header nsstring *path = [nshomedirectory() stringbyappendingpathcomponent:[nsstring stringwithformat:@"documents/videotest4.m4v"]]; //uisavevideoatpathtosavedphotosalbum(path, self, @selector(video:didfinishsavingwitherror:contextinfo:), nil); nsurl *url = [nsurl fileurlwithpath:path]; nsdictionary *options = [nsdictionary dictionarywithobject:[nsnumber numberwithbool:yes] forkey:avurlassetpreferprecisedurationandtimingkey]; avurlasset *asset = [[avurlasset alloc] initwithurl:url options:options]; float64 durationseconds = cmtimegetseconds([asset duration]); generate = [[avassetimagegenerator alloc] initwitha...

asp.net - AES256 encryption and decryption in ASP -

i have send username , password iphone app asp server page, , encrypt them using: http://iphonedevelopment.blogspot.com/2009/02/strong-encryption-for-cocoa-cocoa-touch.html . best way decrypt these strings on asp page? found examples, since encryption happen on 2 unrelated sides, think need hard code key in on both sides, , can't find examples don't have use generated keys. thanks! yes, key management big problem. have have keys on both sides, on ios can save key in keychain, secure process there securely more difficult. the other main issue getting parameters same on both sides. of particular interest are encryption key value , size mode: cbc, ecb, etc. (you should using cbc) initialization vector (iv) needed modes padding method: pkcs7, etc. (aes block cypher , needs input in multiple of block size)

winforms - C#: Datagridview not displaying the data -

i working on winforms application. on form drag , drop datagridview control , set of properties using properties window. following code using populate datagridview. wrote code inside constructor. list<mycustomclass> lst = new list<mycustomclass>(); lst = loadlist(/*some params here*/);//now uptil point works i.e list contains values desribed. datagridview1.datasource = lst; the problem when run program nothing displayed in datagridview. for more details following code represents properties set using properties window this.datagridview1.allowusertoaddrows = false; this.datagridview1.allowusertodeleterows = false; this.datagridview1.allowusertoresizerows = false; this.datagridview1.anchor = ((system.windows.forms.anchorstyles)(((system.windows.forms.anchorstyles.top | system.windows.forms.anchorstyles.left) | system.windows.forms.anchorstyles.right))); this.datagridview1.autosizecolumnsmode = system.windo...

android random number generator not random enough -

i made yahtzee game player rolls 5 dice , use random number generator determine dice values. dice seem random enough when run on emulator, reason when run on phones players keep getting same values many of dice: coincidence. instance, if 4 comes on 1 dice, comes on 3 or 4 other dice. makes hard find problem isn't consistent: throw normal. determine random numbers 5 dice using following code: public void randomdize(){ int randspot; for(int = 0; < 5; i++){ random randomgenerator = new random(); randspot = randomgenerator.nextint(6); if(dieset[i]== 0){ dieval[i]=randspot; imagebuttons[i].setbackgroundresource(imageres[randspot]); } } } you instantiate random generator in loop, move outside: private random randomgenerator = new random(); //or even: // private static random randomgenerator = new random(); public void randomdize(){ int randspot; for(int = 0; < 5; i++){ ...

Text file browser -

i looking freely available program runs on win7, lets me browse through text files in folder. imagining somthing windows photo viewer displays next image file in folder when clicking on [next] button, text files. should open text files regardless of file extention. i've got thousands of 1 line text files in folder , opening them 1 one isn't practical, if check a few dozen @ time. try this methode usignt previewconfig

css - How can I add float property properly? -

on page http://s361608839.websitehome.co.uk/pt-build/templatebuild/index.html if scroll down section called pricing. below right div called priceblock. i'm using css float right somehow div being pushed onto next line. #priceblock { width: 206px; height: 303px; background: url(../images/pricing-bg.jpg) no-repeat; float: right; clear: both; } the div within #pricing , there's enough space in div fit in there without going line. what need change css make float right beside content inside #leftcol within #pricing? thanks your #priceblock rule clearing float nullifying needed effect of float left of #pricing. can fix behavior removing clear both attribute or specifying clear:right: #priceblock { width: 206px; height: 303px; background: url(../images/pricing-bg.jpg) no-repeat; float: right; clear: right; /*clear: both;*/ overflow: hidden; }

node.js - npm install PDFkit fails -

i'm trying install pdfkit node.js using recommended command: npm install pdfkit however fails following messages: zlib@1.0.5 preinstall /home/woody/node_modules/pdfkit/node_modules/zlib node-waf clean || true; node-waf configure build sh: node-waf: not found sh: node-waf: not found npm err! error installing zlib@1.0.5 error: zlib@1.0.5 preinstall: `node-waf clean || true; node-waf configure build` npm err! error installing zlib@1.0.5 `sh "-c" "node-waf clean || true; node-waf configure build"` failed 127 npm err! error installing zlib@1.0.5 @ childprocess.<anonymous> (/usr/lib/node_modules/npm/lib/utils/exec.js:49:20) npm err! error installing zlib@1.0.5 @ childprocess.emit (events.js:67:17) npm err! error installing zlib@1.0.5 @ childprocess.onexit (child_process.js:192:12) npm err! error installing pdfkit@0.1.5 error: zlib@1.0.5 preinstall: `node-waf clean || true; node-waf configure build` npm err! error installing pdfkit@0...

rails routing with just the id in the url and form edit -

my application has article model , url articles this www.mysite.com/21 www.mysite.com/22 in routes.rb have set map.article '/:id', :controller => 'articles', :action => 'show' everything works fine. while editing article, form doesn't updated form action pointed article path for example, form generated <form action="/48" class="edit_article" enctype="multipart/form-data" id="edit_article_48" method="post"> . . . </form> when submit form, goes article show page. this _form.html.erb partial <% form_for @article, :html => { :multipart => true } |f| %> . . . <% end %> has faced kind of problem before? please help thanks you should configure routing requests retrive article while put/post requests invoke other actions update/create articles. refer rails guide routing more information. btw assuming using rails 2. i recommend use re...

hibernate - bi-directional in test_data.yml -

if have code @entity public class category extends model { public string title; public category() {} public category(string title) { this.title = title; } @onetomany(cascade = cascadetype.all, fetch = fetchtype.eager) @joincolumn(name="parent") public list<category> children = new linkedlist<category>(); @manytoone @joincolumn(name="parent", insertable=false, updatable=false) public category parent; public void addchild(category child) { category root = this; child.parent = root; root.children.add(child); root.save(); } } and want create test data in test_data.yml file how can type there? mean bi-directional.. for example if this: category(root1): title: root children: [child1, child2] category(child1): title: child1 parent: root1 category(child2): title: child2 parent: root1 i error: cannot load fixture initial-data.ym...

pdb protein bank format - ligand removal -

i remove various ligands pdb records. sufficient remove het, hetnam,hetatm...., ie. those, compound identified 3letter code, or necessary clean other fields? is there python|perl script written purpose? open(file,"file.pdb"); @file=<file>; foreach (@file){ if (/^hetatm/){ print $_,"\n"; }} this seperates out ligand. delet ligand, keep not equal infront of regex.

database - mysql multiple table/multiple schema performance -

a quick bit of background - have table "orders" has 10k records written per day. queried table in database. keep table small plan move records written week or ago different table. done automated job. while understand make sense pop history off separate server have single db server. the orders table in databasea. following approaches considering: create new schema databaseb , create orders table contains history? create table ordershistory in databasea. it great if pointers design give better performance? edit: better performance querying current orders - since not weighed down past data querying history i take question want deal current orders. in past, have used 3 tables on busy sites new orders, processing orders, filled orders, and main orders table orders all these tables have relation orders table , primary key. eg new_orders_id, orders_id processing_orders_id, orders_id .... using left join find new , processing orders shoul...

ruby - RGB color picker for Rails 3 -

status : building app in needed field available user select color, field contain rgb color code string. i have tested 1 looks pretty not work well. 'picky-color' , hosted in repository: https://github.com/astorsoft/picky-color . here open issue problem it. problem : please suggest me color picker use in rails 3 app. perhaps list on page jquery ui development: color picker gives 1 works out of box. reason jquery included in rails 3 applications, using on base of prototype or javascript library more difficult. the integration in ruby should not difficult, though.

iphone - Nsstring objects changing its data type -

Image
i have nsstring property declared in variable, used store text string when performing parsing operation. parsing operation happens mulitple times, nsstring property changes bizzardly random data type , crashing application. happens when try compare property other local variable string. time compare, appdelegate variable has changed data type, , hence crashes app. any 1 ever come across such issue? if so, please guide me. it sign nsstring object has been deallocated send message deallocated object. crashes application. datatype changes because after object deallocated memory placed in not correct anymore , may contain trash. should use run performance tool -> leaks tool. helps lot in such cases. please keep in mind should enable zombie object detection in settings.

c# - Linq to XML Query not picking anything -

i have rather complex xml document <itemsearchresponse xmlns="-------"> <operationrequest> <httpheaders> </httpheaders> <requestid>0s57wgdpnc7t8hnbv76k</requestid> <arguments> </arguments> <requestprocessingtime>0.441776990890503</requestprocessingtime> </operationrequest> <items> <request> <itemsearchrequest> </itemsearchrequest> </request> <totalresults>1020</totalresults> <totalpages>102</totalpages> <item> <asin>b004wl0l9s</asin> <salesrank>1</salesrank> <itemattributes> <manufacturer>georgia pacific consumer products lp (cut-sheet paper)</manufacturer> <title>gp copy &amp; print paper, 8.5 x 11 inches letter size, 92 bright white, 20 lb, ream of 500 sheets (998067r)</title> <i...

How can I do these image processing tasks using OpenGL ES 2.0 shaders? -

Image
how can perform following image processing tasks using opengl es 2.0 shaders? colorspace transform ( rgb/yuv/hsl/lab ) swirling of image converting sketch converting oil painting i added filters open source gpuimage framework perform 3 of 4 processing tasks describe (swirling, sketch filtering, , converting oil painting). while don't yet have colorspace transforms filters, have ability apply matrix transform colors. as examples of these filters in action, here sepia tone color conversion: a swirl distortion: a sketch filter: and finally, oil painting conversion: note of these filters done on live video frames, , last filter can run in real time on video ios device cameras. last filter pretty computationally intensive, shader takes ~1 second or render on ipad 2. the sepia tone filter based on following color matrix fragment shader: varying highp vec2 texturecoordinate; uniform sampler2d inputimagetexture; uniform lowp mat4 colormatrix;...

asp.net - how to specify extension for word file and text file in web.config? -

i want give extensions word file , text file .doc , .txt in web.config file. in web.config should write , best practice. new .net please me. add following config file: <appsettings> <add key="fileextension" value="docx"/> </appsettings> then, can read following way: system.configuration.configuration rootwebconfig1 = system.web.configuration.webconfigurationmanager.openwebconfiguration(null); if (rootwebconfig1.appsettings.settings.count > 0) { system.configuration.keyvalueconfigurationelement customsetting = rootwebconfig1.appsettings.settings["customsetting1"]; if (customsetting != null) console.writeline("customsetting1 application string = \"{0}\"", customsetting.value); else console.writeline("no customsetting1 applicatio...

Matlab header files -

i have part of code repeated in number of matlab funcions (.m files). want put code functions can defined in single file (say commandhelper.m) , use these functions in original .m files. (just defined in header files). possible? matlab comes full featured object model documented in object-oriented programming . may provide helper functions static methods. classdef commandhelper methods (static) function text = firstcommand() text = 'firstcommand'; end function text = secondcommand() text = 'secondcommand'; end end end helper functions may called command line or other function, script following syntax. >> commandhelper.firstcommand ans = firstcommand >> commandhelper.secondcommand ans = secondcommand

ajax - How do i pass a variable in the xmlhttp.send function -

how pass variable in xmlhttp.send function var str = "hello" xmlhttp.open("post","./omnama.php",true); xmlhttp.setrequestheader("content-type","application/x-www-form-urlencoded"); xmlhttp.send("fname=+str"); ' fills database str not hello i tried these not working xmlhttp.send("fname=" +str,"lname=" +cool); it fills fname variable value not lname, lname gives empty string how combine if have many variables pass on ? xmlhttp.send("fname=" + str); should work xmlhttp.send("fname=" +str + "&lname=" +cool);

analytics - Problems with mongodb -

i creating application cache tweets of users of application , display them timeline page. using mongodb store tweets. mongodb worked fine number of tweets exceed 10,000 have mongocursor error showing following uncaught exception 'mongocursortimeoutexception' message 'cursor timed out (timeout: 30000, time left: 0:0, status: 0) uncaught exception 'mongocursorexception' message 'couldn't send query: broken pipe' uncaught exception 'mongocursorexception' message 'couldn't response header' i have used proper indexing. problem? the basic problem line timeout: 30000 the query has been running long , therefore has been terminated. check following 1) query indexed using explain() 2) whether mongostat reporting "idx miss %" indicate whether indexes in memory , whether had go disk traverse index 3) whether mongostat reporting high "locked %" 4) whether disk bound, try running "iostat -x 2" ...

How to integrate smarty in cakephp 1.2? -

can any1 suggest me , complete documentation on integrating smarty templates in cakephp 1.2 , version of smarty should use cakephp 1.2? my advice... dont. should ask why want to. worth of effort can write php in html files {} instead of <?php ?> ? i don't want start war smarty vs php, away smarty. not add value. there nothing smarty adds, rehashes way write code.

javascript - Enclosing external jQuery file in $(document).ready() -

i have external javascript files contain jquery. should enclose of code in each of these external files in $ (document).ready() ? best practice here? thanks! include jquery script above them in page, , have each of other scripts included after it, in normal way. inside each of scripts, put necessary code in $(document).ready() structure. can use multiple times; aren't restricted once.

Signed android app behaves different from when run manually on device from Eclipse? -

i'm feeling screwed after working on problem last century. in advance help! what happened: develop app, game contains game activity uses countdowntimers timed game rounds. pausing, exiting app activity (via pressing power button, home button etc.) works fine when tested on samsung galaxy tab 7", running unsigned app eclipse before has been signed. ecstatic i've completed work, go ahead , sign freaking apk in cmd. test signed app check works fine copy+pasting signed .apk sd card of same galaxy tab , installing after removing old data of app run eclipse of course doesn't work. things going wrong include activity not pausing when press power button when timed round being run (after power device on discover timer has been running while screen powered off , still running, , pause game dialog found), activity being closed when press home key (after press home key , open app again app restarts introductory splash screen of app) , l...

c# - How to make Silverlight Dataform EditTemplate show controls based on checkbox state? -

i want use xaml little code-behind possible. have dataform custom edit template looks this: [ x ] checkbox 1 [ control panel ] i want display set of controls below "checkbox 1" control (where control panel is) if checkbox 1 checked, , if it's unchecked want display different set of controls. i using silverlight 4 (soon use sl 5). there silverlight control holder lets me "switch" active panel visible setting "activepanel" id or something? thanks if familiar mvvm can bind visibility of grids same property checkbox.ischecked binded (of course must use right converters).

How to access input fields in a page from a Chrome extension? -

i trying make chrome extension personal use makes password fields type="text" , can see clear passwords. (i know can find in chrome store, it's want myself). i having hard time accessing actual page content (the page i'm viewing in tab). if do document.getelementbyid('text') this selects element background.html not page i'm viewing. how can access actual page? also, there way can include external javascript file can use functions there? you need use content script - javascript file injected actual page access dom , events.

Update XSD file when sql server schema changes in VS2010 -

i having seems simple problem can't figure out how vs2010 update .xsd file when change schema in sql server database. i have found 2 recommendations far. the first right click xsd file , 'run custom tool'. not update xsd far can tell since added table doesn't appear , table new column isn't updated. the second option delete xsd file , re-add datasource. method updates tables queries added ui lost. because large data model expect there changes (we still in process) schema. @ point appears recourse move ui specific queries database functions stored procedures... is there best practice (or i'm terribly missing toolset)?

nlp - How to use OpenNLP with Java? -

i want postag english sentence , processing. use opennlp. have installed when execute command i:\workshop\programming\nlp\opennlp-tools-1.5.0-bin\opennlp-tools-1.5.0>java -jar opennlp-tools-1.5.0.jar postagger models\en-pos-maxent.bin < text.txt it gives output postagging input in text.txt loading pos tagger model ... done (4.009s) my_prp$ name_nn is_vbz shabab_nnp i_fw am_vbp 22_cd years_nns old._. average: 66.7 sent/s total: 1 sent runtime: 0.015s i hope installed properly? now how do postagging inside java application? have added opennlptools, jwnl, maxent jar project how invoke postagging? here's (old) sample code threw together, modernized code follow: package opennlp; import opennlp.tools.cmdline.performancemonitor; import opennlp.tools.cmdline.postag.posmodelloader; import opennlp.tools.postag.posmodel; import opennlp.tools.postag.possample; import opennlp.tools.postag.postaggerme; import opennlp.tools.tokenize.whitespacetokenizer; imp...

Silverlight Toolkit Chart Y-axis label styling -

i having trouble figuring out how style y-axis labels on chart (silverlight toolkit). have simple example of how this? examples out in wild seem pre 2010, when chart api different. thanks, mike here's sample code changes y-axis display labels in hours instead of minutes , changes font size 8 (secondstohours converter code not included). can lots of other kinds of formatting in style. should started. <style x:key="hourslabel" targettype="{x:type charting:axislabel}"> <setter property="template"> <setter.value> <controltemplate targettype="{x:type charting:axislabel}"> <textblock text="{binding converter={staticresource secondstohoursconverter}}" fontsize="8" /> </controltemplate> </setter.value> </setter> </style> <charting:chart.axes> <charting:linearaxis orientation="y...

css - png files not displaying in IE -

hello can tell me why css not display png in ie? many thanks #header { width:1004px; height:309px; float: left; margin:0px; padding:0px; background-image::url(../images/header.png); background-repeat:no-repeat; } there double colon in ::url try this: #header { width:1004px; height:309px; float: left; margin:0px; padding:0px; background-image:url(../images/header.png); background-repeat:no-repeat; }

android - Filters for phone and tablets in Google Play -

i want put filter application google play. want display application phone devices , not tablet users. so kind of filter can put except <screen-supports> ? there specific filter phone or tablet or pads? declaring app tablets; <supports-screens android:smallscreens="false" android:normalscreens="false" android:largescreens="true" android:xlargescreens="true" android:requiressmallestwidthdp="600" /> declaring app handsets <compatible-screens> <!-- small size screens --> <screen android:screensize="small" android:screendensity="ldpi" /> <screen android:screensize="small" android:screendensity="mdpi" /> <screen android:screensize="small" android:screendensity="hdpi" /> <screen androi...

gpu - what is the difference between a NVIDIA Quadro 6000 and Tesla C2075 graphic cards? -

i looking gpu computing , can't figure out technical / performance differences between nvidia quadro 6000 , nvidia tesla c2075 graphics card. both have 6gb of ram , same number of computing cores. what's difference? want cuda computations card. edit: please, if nvidia says card x climate calculations, card y great seismic processing, nothing pr. there no graphic card made climate calculations. card either single or double precision computing, or ffts etc. , that's questions here: technical differences , kind of computations should expect faster results on 1 card vs other. the biggest hardware difference tesla cards have ecc memory , important if you're doing long computations , want able believe results.

arrays - PHP: Foreach echo not showing correctly -

the output should this: 1. yougurt 4 units price 2000 crc but i'm getting this: item. y y unitsyquantity. 3 3 units3code. s s unitssprice. units this script: <?php session_start(); //getting list $list[]= $_session['list']; //stock $products = array( 'pineaple' => 500, 'banana' => 50, 'mango' => 150, 'milk' => 500, 'coffe' => 1200, 'butter' => 300, 'bread' => 450, 'juice' => 780, 'peanuts' => 800, 'yogurt' => 450, 'beer' => 550, 'wine' => 2500, ); //saving stuff $_session['list'] = array( 'item' => ($_post['product']), 'quantity' => ($_post['quantity']), 'code' => ($_post['code']), ); //price $price = $products[($_session['list']['item'])] * $_session['list']['quantity']; $_session...

edit input value before saving in Rails -

hi have simple input field url user: <%= f.text_field :url, :value=>"#{@url_website}" %> i process input check if put http:// before it, , if not, add manually. run function on before saving? how done? thanks! well should put before_save in model format text, if model this before_save :format_url def format_url #put important here end

xna - Playing a Video (MSDN Tutorial) -

when trying example on http://msdn.microsoft.com/en-us/library/dd904198(v=xnagamestudio.40).aspx program crashes on line 69: " player.play(video); " error message: "an unhandled exception of type 'system.invalidoperationexception' occurred in microsoft.xna.framework.dll additional information: unexpected error has occurred." i did not change single character in code, used files came out of videoplayback_4_0.zip folder. (can directly downloaded http://msdn.microsoft.com/en-us/library/dd904198(v=xnagamestudio.40).aspx ) i have read in other forums people experiencing same problem, not find usable solution. know causes problem , how fix it? stack trace microsoft.xna.framework.dll!microsoft.xna.framework.helpers.throwexceptionfromerrorcode(microsoft.xna.framework.errorcodes error) + 0x3d bytes microsoft.xna.framework.video.dll!microsoft.xna.framework.media.videoplayer.play(microsoft.xna.framework.media.video video) + 0xb7 bytes video...

Drawing a "3D-looking" line in OpenGL -

Image
when draw line in opengl, gllinewidth creates fixed-size line, regardless how close line you. i wanted draw line appear bigger when it's close. now, understand if use rectangle achieve effect, bit pixelated once polygon far enough. what i've done draw normal gl_line point line bigger pixel size, , continue rectangle point. however, it's not fast chucking down vertex array or vbo, had recalculated every frame. what other methods available? or stuck this? i use gradated texture draw lines: this alpha of texture. have opaque center fading transparent @ edges. can draw line using rectangle points: (x1,y1,0,0), (x2,y1,1,0), (x1,y2,0,1), (x2,y2,1,1) where last 2 entries in each tuple u , v of texture. ends looking smooth. can string lots of small rectangles make curvy lines.

C Language Program Compiled Will it use multicore cpu? -

platform: windows xp processor : dual core i have program written in c language compiled , exe formed. question program use both cores (since machine dual core) or have make program multithreaded in order ? you have implement multithreaded program when want use multiple cores. there plenty of threading libraries out there. i'd recommend have openmp , quite easy integrate , use parallization. edit: simple example: normally can parallelize for loops adding: #pragma omp parallel for(...) of course, have link against openmp , compile openmp support.

eval - How to pass a 'BeautifulSoup.Tag' object inside http post request in google app engine? -

i have beautifulsoup.tag object want transfer in http post request. request task in google app engine perform. this code: taskqueue.add(url='/maintenance', method='post', params={'row': row}) when receive request on other end, parameter row unicode string. how original object back? undersand json eval won't work kind of object, there solution compelled pass simple objects only? hmmm. beautiful soup kind of evaluator. can send object's html , reuse beautiful soup. i did way: taskqueue.add(url='/maintenance', params={'element': str(myobject)}) and reused soup inside task itself: payload = self.request.get('element') soup = beautifulsoup(payload)

Application.js placement - Rails 3 & jQuery -

i'm dabbling jquery first time on first rails (3) project. i'm having trouble getting select statement's onchange fire when application.js include in header. this current set-up: header includes: <%= javascript_include_tag "http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js" %> <%= javascript_include_tag 'rails' %> <%= javascript_include_tag 'application' %> <%= csrf_meta_tag %> application.js jquery('#location_country_code').change(function() { alert('hi'); }); my problem can onchange function fire if place application.js include @ bottom of page (ie: after select element). appears placing in header means event handler not set element not yet defined. all tutorials on type of thing talk putting js code in application.js i'm assuming i'm missing fundamental. thanks in advance help/advice. you should encapsulate jquery in "document ready"...

android - What is the currently focused component? -

i have activity , activity start new one. (the second) activity quite complex , point want know component (which widget) focused. well problem have soft keyboard shown on devices (and same build of app starts activity b hidden keyboard). is there command or snipped can find of component(widgets) has focus @ moment ? edit: getcurrent focus return null :( getcurrentfocus() on window of activity returned focused view. called getcurrentfocus in wrong place :).

Start and stop animation with CABasicAnimation iphone -

i want use animation image, start on button clicked , stop after 5 seconds.i use code. -(ibaction) btnclicked{ cabasicanimation *fullrotation = [cabasicanimation animationwithkeypath:@"transform.rotation"]; fullrotation.fromvalue = [nsnumber numberwithfloat:0]; fullrotation.tovalue = [nsnumber numberwithfloat:((360*m_pi)/180)]; fullrotation.duration = 6; fullrotation.repeatcount = 1e100f; fullrotation.delegate = self; [imgview.layer addanimation:fullrotation forkey:@"360"]; [imgview.layer setspeed:3.0]; } with code animation started don't know how stop animation after 5 seconds. dont deal coreanimation. think can done uiview animations, easier program. @ uiview docs , try block animations (assuming ios4.0. if not, use older style). look @ http://developer.apple.com/library/ios/#documentation/windowsviews/conceptual/viewpg_iphoneos/animatingviews/animatingviews.html%23//apple_ref/doc/uid/tp40009503-ch6-sw1 docs on uiview animations. set tran...

extjs3 - How to set grid height row in extjs -

in code i'm using 4 grids, i've set row height in css this: .x-grid3-row td {line-height: 50px;} , sets rows of grids. need set height row of 1 of grids. based on id or cls class can specify css eaxch component individually. example,if have grid id sample code be: .sample .x-grid3-row td {line-height: 50px;}

iphone - Formatting UITableViewCell -

Image
i have uitableview cell , need set it's label "sometext (number)". can that, need "(number)" grayish, how can that? here's image might make trying ask clearer: i need 12, 24, 48, 96 gray in picture. thanks. you need 2 uilabels, you'll have the label1.textcolor = [uicolor blackcolor]; label2.textcolor = [uicolor graycolor]; now that's obvious part, when set text on label1 you'll have label1.text = ...; cgsize newsize = [label1.text sizewithfont:label1.font constrainttosize:cgsizemake(320, label1.frame.size.height)]; label2.frame = cgrectmake(label1.frame.origin.x + newsize.width + 5., label2.frame.origin.y, label2.frame.size.width, label2.frame.size.height); stay close they're 1 label.

windows - Command prompt in debug mode for Eclipse? (OpenCV + Eclipse + Win7) -

i beginner eclipse. have eclipse c/c++ ide opencv library running on windows 7. far works after spending hours trying running. realize eclipse not pop command prompt vs2010 while debugging. , eclipse's debug mode stuck in there , refuse output anything. if code doesn't involve opencv things works again. below code use testing. captures images webcam , output screen. infinite loop (until press 'q') makes sure grabs new inputs camera. i browsed through workspace , run exe compiled , worked flawlessly. don't think there's wrong in code (it's example code anyway in brief, can pop command prompt window in debug mode? , why eclipse console stuck when code involves opencv functions? #include <stdio.h> #include <stdlib.h> #include <tchar.h> #include <cv.h> #include <cxcore.h> #include <highgui.h> #include <iostream> int _tmain(int argc, _tchar* argv[]) { cvcapture *capture = 0; iplimage *frame = 0; ...

pymongo - Using JSON in Python to send query to MongoDB -

i'm trying create following query in python connection have mongodb. db.deal.find({"id":"11223|14589"}) by using writing following code: import json unique_id = "11223|14589" query = json.dumps({"id":"%s"}) %(unique_id) unfortunately, creates string, , results don't returned results mongodb. querying manually using string created in variable query returns results. know might working pymongo? not sure you're trying achieve here. first of all, should not have serialize json. not replace parts of string after it's serialized . second, unique_id 1 value you're looking for? if so, pass query: unique_id = '11223|14589' foo.find({'id': unique_id}) or these 2 values you'd search for? unique_id = '11223|14589' ids = unique_id.split('|') # ['11223', '14589'] foo.find({'id': {'$in': ids}})

How to minify different javascript files at runtime using Java -

i'm trying build (or find existing 1 can use) web filter compress javascript file @ runtime. i've tried building 1 based on yuicompressor, i'm getting weird errors out of when try , pass string based source instead of actual file. now i'm expecting bombarded responses 'real time compression/minification bad idea' there reason i'm not wanting @ build time. i've got javascript web application lazy loads it's javascript. load needs. javascript files can specify dependencies , have filter concatenate requested files , dependencies not loaded single response. means there large number of different combinations in javascript sent user makes trying build bundles @ build time impractical. so restate. ideally i'm looking existing real time javascript filter can plug app. if 1 doesn't exist i'm looking tips on can use building blocks. yuicompressor hasn't quite got me there , googleclosure seems web api. cheers, peter i...

.net - Why do the following differences in Silverlight implementations exist between MAC and Window versions -

i reading through list of differences between silverlight implementation windows , implementation mac. can found here . while of differences related platform diffirences etc. there wonder why different @ all. if has thoughts or actual concrete information on this, interested hear input. here few of things seemed strange, last point in list, prompted me post question. char.tolower(char, cultureinfo) - on mac current culture used rather specified culture. strange since mac presumably support multiple cultures (i don't own mac or know assumption on part) decimal/single/uint16/uint32/uint64 - document states mentioned types not supported, os not support them 'emulated' (i use term 'emulated' loosely since underlying cpu supports them excluding decimal of course). double/single *infinity properties - why have these return different strings on different platforms. not saying people should use string representation comparisons, silly, why make them differe...

entity framework - EF4 - Linq - Exception on Query.Any() -

i've using ef while i've never had problem. have wcf services provide data web front end. in service, use ef 4 data implementation. bypass repository , singleton, simple function below: using (ourentities datacontext = new ourentities()) { datacontext.order.mergeoption = system.data.objects.mergeoption.notracking; list<order> orders = new list<order>(); var query = p in datacontext.order.include("orderdetail") (p.orderid == orderid || orderid == 0) && (p.orderstatus == orderstatus || orderstatus == 0) && (p.ordertype == ordertype || ordertype == 0) && (p.orderflag == null || p.orderflag == false) select p; if (query.any()) { foreach (order order in query) { orders.add(order); } } return orders; } orderid, orderstatus & ordertype passed in parameters. code works without...

How to compile pom.xml without generating project in Maven? -

i have pom.xml file contains dependencies , files checkout svn there no no need generate project. need these libraries , files, there way them without generating project maven directory structure? i'm not sure question want. if have pom.xml file , want download dependencies defined in it, can call mvn dependency:copy-dependencies for more options maven copy-dependencies task page if asking how create pom contain no code, dependencies, can specifying pom packaging.

javascript - keydown (repetition) breaks when keyup event (for ANOTHER key) is fired -

this bit of weird 1 figure i'm either missing obvious or flaw how these events implemented in browsers. let me first summarize example scenario issue comes before providing isolated case-example; the arrow keys used move player (as handlekeydown function fired anytime key hit anywhere on page). likewise, anytime key released function fired (handlekeyup). as (the player) hold left key down, handlekeydown function repeatedly triggered (which admittedly think defies you'd expect , name implies, nonetheless, normal behavior across browsers i'm sure know). so here's happens: player holds direction walk in direction; press number key (for hot-keyed item) continue walk while holding direction down. happens here release number key hot-keyed item, repetition player movement stops! i've written small isolated example of behavior: <html> <head> <script type='text/javascript' src='jquery-1.5.1.min.js'></script> ...

yii - How to specify image paths in CSS files? -

i'm using yii framework , have css file uses images background , similar. other php code can use yii::app()->request->baseurl prefix resources correct path. however, css file not php, cannot use code. i tried relative paths, same css file accessed html pages of different depth, example: http://mysite/controller/action1/10 http://mysite/controller so relative paths don't work (at least, not in browsers). is there yii-way of doing this, or should use absolute paths , done it? the paths images in css files relative css file, not page referencing css file. so shouldn't matter using css file in html pages @ different path depths, looks location of css. for example, if css file in /content/css , images in /content/images should reference images url(../images/something.png) .

php - generate class name? -

how can this? require_once 'class.table_'.$table.'.php'; $class = new table_$table(); $classname = $var.'somestring'.$var2; $obj = new $classname(); in case $classname = 'table_'.$table; $obj = new $classname();

postgresql - Django+Postgres: "current transaction is aborted, commands ignored until end of transaction block" -

i've started working on django/postgres site. work in manage.py shell , , accidentally db action results in error. unable any database action @ all, because database action try do, error: current transaction aborted, commands ignored until end of transaction block my current workaround restart shell, should find way fix without abandoning shell session. (i've read this , this , don't give actionable instructions on shell.) you can try this: from django.db import connection connection._rollback() the more detailed discussion of this issue can found here

mysql - The left joins making query slow,is there any method to increase the speed of this query -

select b.entry_id, b.assign_id, a.profile_type, a.profile_id, a.profile_name, a.profile_status, b.entry_type, b.assign_id, c.chapter_name, d.section_name, h.group_name, i.programme_name, k.subjectprogramme_name, j.masterprogramme_name, l.developmentprogramme_name profile_master left join profile_assign b on (a.profile_id = b.profile_id) left join chapter_master c on (b.entry_id = c.chapter_id , b.entry_type='chapter') left join section_master d on (b.entry_id = d.section_id , b.entry_type='section') left join group_master h on (b.entry_id = h.group_id , b.entry_type='group' , h.year_id='".$this->year."') left join programme_master on (b.entry_id = i.programme_id , b.entry_type='programme' , i.year_id='".$this->year."') left join subjectprogramme_master k on (b.entry_id = k.subjectpro...

portal - Use SAP Logon ticket with .Net Application using SSO22KerbMap or SAPSSOEXT -

i looking option on using single sign on (sso) sap portal non-sap asp .net application. reading through documents , online searches, found there couple of approaches 1. use "sapssoext" evaluate logon ticket in .net application. 2. use "sso22kerbmap" isapi module. the .net application configured use integrated windows authentication using active directory. but, need support sso sap portal. without sso, if user signs .net app user b's system, .net app windows authentication , treat user b logged in user. option 1 involves developing new code .net application not support , may not possible in case. option 2 sounds promising, not clear on how work. sounds module verifies sap logon ticket , acquires constrained kerberos ticket. but, confused how .net application use constrained kerberos ticket. option 2 seamless bridge install , .net app support sso magic? love if did that, sounds true. :) any pointers helpful understanding.

graphics - OpenGL ES/Android -- Is there a built-in function to reset the scale, translation, rotation of a object? -

my program draws object, translates, rotates, , scales it, redraws it, etc etc. set translation do: gl.gltranslatef(2,4,666); then clear gl.gltranslatef(-2,-4,-666) ; i'm wondering if there's built in function so? glpushmatrix() , glpopmatrix() normal ways this. push before applying gltranslate, pop when done , revert stack. have remember, opengl state based system uses stack. when apply gltranslatef, adding translate function stack, drawn after placed on stack have translation done it. calling gl.gltranslatef(2,4,666); and gl.gltranslatef(-2,-4,-666); if understand correctly, cause scene first move object (-2,-4,-666), (2,4,666). because stack, last transformation apply gets applied first, , first last. helps remember little fact while you're setting scene. put push before gl.gltranslatef(2,4,666);, , pop after , should good. glpushmatrix(); gl.gltranslatef(2,4,666); //draw code here glpopmatrix(); just remember whole stack thing , should a...

Airpush ads for Android -

i want implement airpush ads in app, want users able choose between airpush ads , mobclix ads. permissions api airpush requires user-encrypted imei. android sdk returns unencrypted imei, doesn't it? have sample code how implement this? thanks in advance. apps not getting banned because of airpush. google reinstated 1 app banned day , said looking airpush practices. it's option if users not in-app ads. give user choices.

c# - Exposing and consuming NetTcpBinding from silverlight -

i'm trying expose , consume wcf service using nettcpbinding (i have basichttpbinding working already) don't know how expose new nettcpbinding. i've read may use microsoft service configurator editor configure service can't find "step-by-step" guide configured manually: <services> <service behaviorconfiguration="behavior" name="serviceimplementation"> <endpoint address="net.tcp://localhost:4445/service" binding="nettcpbinding" bindingconfiguration="" name="service" contract="iservice" /> </service> </services> now want consume silverlight dll project , don't know how try it. if add web reference http services doesn't connect "net.tcp://localhost:4445/service" (it rejects connection). how should it? know step step guide? in advance. silverlight not support bindngs. nettcpbinding 1 not supported. see http://msdn.micr...

CakePHP - save multiple HABTM data w/ dropdowns in same form -

when user adds event, want them able choose band(s) playing @ event. have events table , bands table each habtm model associations other. on "add event" page, have dropdown displaying bands, can choose one. echo $this->form->input('band', array('multiple'=>false, 'empty'=>true)); i have "add band" button, , when clicked, adds dropdown. think know how dynamic field-adding thing - - when try this: (just see if can work) echo $this->form->input('band', array('multiple'=>false, 'empty'=>true)); echo $this->form->input('band', array('multiple'=>false, 'empty'=>true)); echo $this->form->input('band', array('multiple'=>false, 'empty'=>true)); it doesn't save 3 rows in bands_events habtm table - saves one. , when try edit event, 3 select dropdowns default-select 1 of selected bands, not (obviously can't, sin...

css - How do I create a full-browser-width bar without screwing up zoom on an iPhone? -

i trying create bars of color stretch way across screen http://css-tricks.com/9443-full-browser-width-bars/ , not possible rearrange dom make easier. the technique awesome on desktop browsers, on mobile webkit overflow-x not hidden , can zoom way, way out or scroll on parts of page contain improbably-wide color bars. doesn't set viewport. how effect without screwing zoom? have tried adding overflow-x: hidden; parent element of scroll-bars? have found technique useful when developing webkit based mobile browsers. <body> <div id="wrap" style="overflow-x: hidden;"> <div id="massive_coloured_bar" style="your full-width technique here"></div> </div> </body>

Get mail subject using applescript -

i'm writing script using mail applescript template (file > new template > mail > mail rule action.scptd) doesn't seem examples in template working using terms application "mail" on perform mail action messages these_messages rule this_rule tell application "mail" set message_count count of these_messages repeat 1 message_count set this_message item of these_messages try set this_subject (subject of this_message) unicode text if this_subject "" error on error set this_subject "no subject" end try this_subject end repeat ...

Dedupe and sort a list in Python 2.2 -

in python 2.2 (don't ask), what's neatest way sort list , remove duplicates? i can write function sort() iterate, wondering if there's idiomatic one-liner. edit: list short, efficiency not concern. also, elements immutable. for old python versions, , since you're using strings, there's no one-liner can think of, pattern this, using dictionaries: def sorted_uniq(your_list): table = {} s in your_list: table[s] = none k = table.keys() k.sort() return k adapted ancient activestate code snippet thread alex martelli himself wrote several comments on: http://code.activestate.com/recipes/52560/ a shorter way list comprehensions: def sort_uniq(alist): d = {} mod_list = [d.setdefault(i,i) in alist if not in d] mod_list.sort() return mod_list aside steven's neat (yet unattractive) 1 liner, think heads toward fewest lines , idiomatic way of doing python 2.2: thanks steven rumbalski in comments, 2nd ve...

c# - F# light weight scripting enviorment -

im using f# little scripting automating tasks on our servers here. love have light weight environment install on servers give me fsi , auto-completion thank you just clarify im looking powershell ise vs auto completion i don't think there complete project includes completion, funtasticolor looks interesting. support auto-completion , tool tips added using simple command line tool .