Posts

Showing posts from March, 2011

css - Exploding animation using css3. -

i'm new site , coding. trying find out how create exploding image on hover using css or css3. can tell me if possible. comments great. if want break multiple pieces when ‘exploding’, don't think can css3. if, on other hand, consider making large ‘exploding’, doable: img { transition: 0.5s; } img:hover { opacity: 0; transform: scale(3) rotate(10deg); } try it.                          okay, guess that's not of explosion, oh well

MySQL Trigger causing unknown system variable error on existing row -

i creating trigger in mysql , getting 'unknown system variable' on 'unique_id' row in 'pending_jobs' table. trigger code below: create trigger format_pending_jobs_unique before insert on pending_jobs each row begin set unique_id = concat(prefix_unique_id, id); end basically it's concatenating 2 rows (prefix_unique_id , id) row unique_id when new row inserted. prefix_unique_id row has default value of "sa" value of of them , id index of row auto increment. i'm new triggers , had read in post on stack overflow use := instead of = didn't fix problem. i'm using phpmyadmin , see unique_id (as prefix_unique_id , id) rows exists. great. thanks! i write trigger way: create trigger format_pending_jobs_unique before insert on pending_jobs each row set new.unique_id = concat( new.prefix_unique_id, (select auto_increment information_schema.tables table_schema=database() , table_name=&

java - Wondering what should I do if the length of an array is even -

i have written code find middle element sorted array. here part of code: java code: int[] = {1,2,3,4,5}; int x = a.length; if (x % 2 != 0){ int mid = 0 + x/2; system.out.println("the middle element : " + a[mid]); } i'm getting output wondering should write in else condition of code above? in other words, should find middle element if a.length even? possible? we can't answer you. depends on requirements. here options: return 2 middle ones. return earlier option that's in middle. throw exception method can't called on length. etc.

c++ - Memory issues with threads -

i'm working on multi-threaded server application. have struct try pass 2 threads: struct params{ safequeue<int> *mq; database *db; }; class server{ server(database *db){ dword sthread, ethread; params *p; p = new params; p->db = db; safequeue<int> *msgq = new safequeue<int>; p->mq = msgq; cout << "address of params: " << p << endl; cout << "address of safequeue: " << msgq << endl; cout << "starting server...\n"; createthread(null, 0, smtpreceiver, &p, 0, &sthread); createthread(null, 0, mqueue, &p, 0, &ethread); } } dword winapi mailqueue(lpvoid lpparam){ params *p = (params *) lpparam; safequeue<int> *msgq = p->mq; cout << "address of params: " << p << endl; cout << "address of safequeue: " << msgq << endl; cout << "queue thread

python - extract string within string with out double quote -

this learning purpose, have following code. if wanna extract 'abcbc' out double quote? tried re.search(r'\a\"(.*?)\"',a).group() noting change. >>> = "\"abcbc\" lol" >>> re.search(r'\a"(.*?)"',a).group() '"abcbc"' also if change pattern '\a"(.*?)' should return after double quote? gives following. there wrong? >>> re.search(r'\a"(.*?)',a).group() '"' you capturing want in group, calling group() no arguments, returning entire match (group 0), not group want (which group 1). call .group(1) return first group, has want. >>> = "\"abcbc\" lol" >>> re.search(r'\a"(.*?)"',a).group(1) 'abcbc' as second question, *? non-greedy: match little can. since * allows matching zero, *? match nothing if can --- , can, since don't have after force match point.

enthought - Cannot launch Canopy in GNU/Linux (openSUSE 12.3) -

after installation, when do $ ~/canopy/canopy i traceback (most recent call last): file "/home/joon/canopy/appdata/canopy-1.0.0.1160.rh5-x86_64/__boot__.py", line 9, in <module> sys.exit(main()) file "build/bdist.linux-x86_64/egg/canopy/app/bootstrap.py", line 1335, in main file "build/bdist.linux-x86_64/egg/canopy/app/bootstrap.py", line 1315, in send_bug_report file "build/bdist.linux-x86_64/egg/canopy/feedback/data_reporter.py", line 390, in start file "/home/joon/canopy/appdata/canopy-1.0.0.1160.rh5-x86_64/lib/python2.7/site-packages/enaml/core/import_hooks.py", line 131, in load_module exec code in mod.__dict__ file "/home/joon/canopy/appdata/canopy-1.0.0.1160.rh5-x86_64/lib/python2.7/site-packages/canopy/feedback/data_reporter_view.enaml", line 4, in pyface.api import clipboard file "/home/joon/canopy/appdata/canopy-1.0.0.1160.rh5-x86_64/lib/python2.7/site-packages/pyface/a

Vertical issues with YouTube modal window, CSS and HTML only -

i'm trying make modal window plays youtube video. final result should dynamically resize fill contents of viewport while respecting 16:9 aspect ratio. should stop expanding once has reached 720p. i'm running these problems: the video not respect height of viewport if width large (overflow) the video not @ vertically centered i have no idea @ how fix these. have looked hours @ many similar stack overflow questions , have not made progress. there hope? my html: <div id="youtube-overlay"> <div id="youtube-margin"> <div id="youtube-container"> <iframe class="youtube-hd" src="http://www.youtube.com/embed/novw62mwsqq?rel=0&autoplay=1&autohide=1&showinfo=0" frameborder="0" ></iframe> </div> </div> </div> my css: #youtube-overlay { background-color: rgba(0, 0, 0, .85); height: 100%; width: 100%;

scanning - Using TWAIN in .NET - Looking for resources -

i'm trying write sort of code in .net acquire images network scanner. have tried wia , can't see network scanner, looking @ twain now. where problem comes in having great trouble finding current information on how go doing this. the main article keeps coming this 2002 codeproject tutorial . works, understand nothing code doing, i'm rather wary using this. there 2009 twaindotnet project on codeplex whichi think have chance of understanding looks more promising. i wondering if there other useful resources out there using twain in .net, or other open source projects, explanations, tutorials or somesuch make easier understand how work twain? or 2 sources found there is? these resources might helpful you: twain specification , twain.h file twain sample data source , application

c# - Getting the SelectedIndex of a LongListSelector Item -

i have wp8 databound app itemviewmodel bound longlistselector . quite simply, when user taps on item in list, need retrieve index number of item selected future use. (0 first in list, 1 second, etc.) so, might retrieve property of selected item: string whateverproperty = (mylonglistselector.selecteditem itemviewmodel).whateverproperty; i need (obviously made code): int indexnumber = (mylonglistselector.selecteditem itemviewmodel).getselectedindex(); i think selectedindex property thing need can't figure out how retrieve it. thank you! edit: solved! following gets me looking for: int selectedindex = app.viewmodel.items.indexof(mainlonglistselector.selecteditem itemviewmodel); i had same problem. need use itemsource retrieve index. should match data template index index. int selectedindex = selector.itemssource.indexof(selector.selecteditem itemviewmodel); selector references longlistselector object sender. hope helps!

css - Making divs center if side by side or stacked -

i have 2 divs side side if window/resolution allows, , stacked 1 on top of other if doesn't. i need them center in both cases. have managed them center 1 case or other not both. layout: <div class="container"> <div class="center"> <div class="left">left</div> <div class="right">right</div> </div> </div> css: div.left { background:blue; height:200px; width:250px; } div.right { background:green; height:300px; width:250px; } div.center { text-align: left; } .container { text-align: center; } .container div { display: inline-block; } you can see here: http://jsfiddle.net/zygnz/1784/ this way has them centered long window bigger side side elements, aligns left when 1 on top of other. how can make centered both cases? change .center class text-align: center : div.center { text-align: center; }

java - How to make alert dialog appear only once when dragging the seek bar -

ok when pull seek bar alert dialog freaks out , comes multiple times on avd. how fix when there no user input in etcash alert dialog shows on screen once. keep on prompting user invalid input until user inputs in edittext created. suggestion!!! have tried no avail !! import java.text.decimalformat; import junit.framework.assert; import android.os.bundle; import android.app.activity; import android.app.alertdialog; import android.content.context; import android.content.dialoginterface; import android.text.editable; import android.text.textwatcher; import android.view.view; import android.widget.button; import android.widget.edittext; import android.widget.seekbar; import android.widget.textview; public class mainactivity extends activity { private seekbar sbcash; private button btnten,btntwenty,btnthirty; private textview tvshwprog,tvfinal; private edittext etcash; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); se

Magento - Fishpig Wordpress - Featured image sizes -

i have installation of magento integrates wordpress using fishpig wordpress module. as wp users know, when uploading image wordpress create resized versions referencing dimensions set in media settings (e.g. thumbnail size, medium size , large size). creates images each custom thumbnail size specify (e.g. via functions.php). it appears though fishpig magento module uses thumbnail image size. unfortunately need able display different sizes of same image (i.e. resized versions wordpress creates) on different pages. example, category page display small version, post view page display larger version. i wondering if has had experience retrieving other resized images via module can't find documentation on (or if it's possible module couldn't see code suggest functionality). greatly appreciate help. i had same issue...i wanted create recent posts widget , fishpig has documented, didn't show example of how pull featured image post. but found answer in

apache - Restoring SQL tables from .MYD, .MYI and .frm files, mysql can't find .frm files -

i had re-install xampp on mac , i'm trying restore sql database tables .myd, .myi , .frm files. have tried dragging them file below: xamppfiles/var/mysql/{database_name} as per instructions in following links how recover mysql database .myd, .myi, .frm files restoring mysql database physical files the table listed in phpmyadmin when try view error below #1017 - can't find file: './{database_name}/{table_name}.frm' (errno: 13) i have tried changing permission on .frm file , running unix executable file xamppfiles/bin/mysql_upgrade mysql server must down while copying files.

join - How can I select distinct column based on max datetime (another column) also joining two tables in MySQL? -

i've read many similar questions here , tried can think of, without success. think i've found question based on single table, or without need getting distinct column, not situation exactly. i want distinct ticker_symbol , corresponding ticker_name , latest ticker_quote based on these tables: create table `tickers` ( `id` int(10) unsigned not null auto_increment, `ticker_symbol` varchar(6) collate utf8_unicode_ci not null, `ticker_name` varchar(128) collate utf8_unicode_ci not null, `created_at` timestamp not null default '0000-00-00 00:00:00', `updated_at` timestamp not null default '0000-00-00 00:00:00', primary key (`id`) ) engine=innodb auto_increment=3 default charset=utf8 collate=utf8_unicode_ci create table `ticker_quotes` ( `id` int(10) unsigned not null auto_increment, `ticker_symbol` varchar(6) collate utf8_unicode_ci not null, `ticker_quote` float(8,2) not null, `created_at` timestamp not null default '0000-00-00 00:

c# - Read POST request with AjaxMethod -

i need read post request in page. using .net 2.0, higher version not possible, , try build page ajaxpro. when send request in js destination, cannot read request using request.form , page.request or other. here code public class ajax : system.web.ui.page{ [ajaxmethod] public string getstring(){ //here read post request return ""; } } did try read data inputstream. 1 such question has more details on this. also, can reset stream , read contents following request.inputstream.position = 0; // read data

java - Parse date/time from string? -

i'm trying create program parse meaningful date , time string. want able give following kinds of input, , create date/time object: 5 o'clock 5 p.m. 5 a.m. 5 530 530 a.m. 530 p.m. tuesday @ [insert above string here] 30th @ [same above] may 12th @ [same above] today @ [same above] tomorrow @ [same above] any string doesn't contain day/date can assumed being today, , time not have am/pm designation can assumed occuring between 9am , 8:59pm. realized mess becoming after writing portion of code: private void createevent(string phrase) { int hour; int day = 0; string dayofweek = ""; if (phrase.contains("o'clock")) { hour = integer.parseint(phrase.substring(phrase.indexof("o'clock")-3, phrase.indexof("o'clock")-1).trim()); out.write(""+hour); } if (phrase.contains("tomorrow")) day = (calendar.day_of_week % 7)+1; if (phrase.contains("sunday&

android - Playing AES-encrypted HLS streams using separate AES key -

i have aes-encrypted hls stream passing android's mediaplayer. normally, aes key passed in part of stream (using #ext-x-key). however, client wants provide key separately. possible pass aes key mediaplayer separately, or need implement own version of mediaplayer in order accomplish this? as states in spec uri the value quoted-string containing uri specifies how obtain key. attribute required unless method none. you key externally , have echo server takes key in base64 return decoded key.

mysql - LOAD DATA INFILE not working inside BASH SCRIPT -

i new ssh ,trying laod csv files through bash script using load data infile syntax using bash script here script: mysql -u $mysql_username -p$mysql_password -d $mysql_database \ load data local infile '$file_tr_hi' table trans_hist_test \ fields terminated ',' lines terminated '\r\n'; this script runs fine individually. mean outside script. when include in script, throws error load command not found how can fix this? try provide full path mysql /usr/local/mysql/bin/mysql -u ...

Grails/Groovy Controller should return Success to ExtJS -

i trying simple extjs - grails/groovy test. groovy server page ( gsp ) file contains below extjs code: it has 2 fields state code , state name. user enters details , click on submit. the submit triggers handler further posts form controller class. function createtender() { var submithandler = function() { alert("submit pressed !"); var formpanel = ext.getcmp('stateform'); formpanel.getform().submit({ url : 'state/savestate', method : 'post', success : function() { alert('state saved successfully!'); }, failure : function() { alert('state save failed!'); } }); } ext.create('ext.form.panel',{ id: 'stateform', height: 300, width: 400, bodypadding: 10, title: 'create state', items: [{ xtype:'textfield', fieldlabel: 'state code', name: 'statecode'

c# - Ajax call back function called always after first call -

i want auto load using ajax call function getdata function keep being called after first same parameters. here javascript codes: var currentpage = 0; var isfinished = false; var lastscrolltop = 0; $(window).data('ajaxready', true).scroll(function (e) { if ($(window).data('ajaxready') == false) return; $(window).scroll(function (event) { var st = $(this).scrolltop(); if (st > lastscrolltop) { if (st > window.innerheight) { var amountvalue = $("#amount").val(); var firstprice = 0; var lastprice = 10000; infinitescroll(firstprice, lastprice); } } }); }); function infinitescroll(firstprice, lastprice) { if (firstprice < 0 || firstprice == undefined) { firs

ios - How to retrieve the .xml extension attachments from mail by using MailCore to Sample iPhone app -

how retrieve .xml extension attachments mail using mailcore iphone ? i used mailcore download attachments mail sample iphone app. getting inbox subjects mail subjects sort particular mail subject , mail attachments. the problem got particular mail subject not attachments. used below code attachments mail it's not working. nsarray *array=[msg attachments]; ctbareattachment *ctbaratt=[array objectatindex:0]; ctcoreattachment *ctcoreatt=[ctbaratt fetchfullattachment]; but i'm getting : array count 0 please share ideas. this few reasons: 1)it possible you're not downloading enough information ctcoremessage. when making request download ctcoremessages must specify information want specifying correct fetch attributes. for example: [core_folder messagesfromsequencenumber:from to:to withfetchattributes: ctfetchattrenvelope | ctfetchattrbodystructure] should populate information attachments. when fetching message imap, command specify informati

c# - How do i add vertical scroll bar in asp Dropdown list? -

my code <asp:dropdownlist id="ddlfrom" runat="server" cssclass="from"></asp:dropdownlist> and css code .from{ width:250px;height:25px} height can not large because there large number of items in it. how add vertical scroll bar drop down ? there few 3rd party controls out there in web, , bing them. put simple workaround involves dropdownextender (of ajax controltoolkit), textbox, listbox, , few lines of javascript. here textbox hold selected value of listbox. aspx code below: <asp:updatepanel id="updatepanel1" runat="server"> <contenttemplate> <asp:textbox id="textbox1" runat="server" text="select item" cssclass="mytextbox"></asp:textbox> <div style="padding: 4px;" id="itemsdiv" runat="server"> <asp:listbox id="listbox1"

Android handle continuous tapping on buttons -

may question needs logic only. we have android app invokes different web services , return data. in app there 2 buttons. have 10 apis (web services). button 1 invoke apis api1, api 2 api 3 , api n. button 2 invoke api10, api9, api 8… api 1. invoking apis in button click using following code handler.postdelayed(new runnable() { public void run() { switchtoapi(true); } }, 100); as of implementation in each click invoking apis. if tapped in button1 invoke api1 , can perform other operations after api1 completed. want, user can continuously tap on buttons. continues tap need not invoke api. api number can changed. if user tapas , wait 2 seconds without taping, corresponding apis should called. can suggest , mechanism? please try use code below: public static void buttonlockthread(final int id, final activity activity) { thread thread = new thread(new runnable() { @override public void run() { // todo auto-generated meth

c# - For valid DateTime(Error shows string was not recognized ) -

i trying convert string formated value date type format dd/mm/yyyy. runs fine when enter fromdate(dd/mm/yyyy) in textbox fine , todate(dd/mm/yyyy) in textbox gives error string not recognized valid datetime.what problem dont know. same code run on appliction run fine in application shows error. below have used array required format , split used. string fromdate = punchin.tostring(); string[] arrfromdate = fromdate.split('/'); fromdate = arrfromdate[1].tostring() + "/" + arrfromdate[0].tostring() + "/" + arrfromdate[2].tostring(); datetime d1 = datetime.parse(fromdate.tostring()); i got 5/13/2013 12:21:35 pm in string fromdate use datetime.tryparseexac t, don't have split string based on / , first 3 items array instead can do: datetime dt; if (datetime.tryparseexact("5/13/2013 12:21:35 pm", "m/d/yyyy hh:mm:ss tt", cultureinfo.invariantcultu

php - Make array from array values and save it to a file -

i working on project in array. when use print_r($arr) looks this: array ( [0] => games, [1] => wallpapers, ..... ) what want want it's value in array array('games','wallpapers') , save file called data.txt using file_put_contents . did once myown using implode() gets error. there way? you need serialize , save file. can comma-separated values using implode() , or json string using json_encode() or using serialize() . 3 of links have excellent documentation , examples. if still have troubles, please edit question more specific details , code you've worked on far.

javascript - Google maps zoom level migration v2 to v3 -

i'm migrating piece of google maps code in javascript v2 v3 the following v2 piece shows map center zoomed in, can see street names , specific details var mapg = new gmap(document.getelementbyid("gmmap")); var point = new glatlng(52.6461049, 6.5583690); mapg.centerandzoom(point, 3); i've tried migrating following var point = new google.maps.latlng(52.6461049, 6.5583690); var mapoptions = { center: point, zoom: 3, maptypeid: google.maps.maptypeid.roadmap }; var map = new google.maps.map(document.getelementbyid("gmmap"), mapoptions); the map centered @ exact same location zoom way off. there difference between zoom values in v2 , v3? or did migrate wrong way? if change 3 15, zooming equal. since i'm migrating client environment, want same v2 documentation: https://developers.google.com/maps/documentation/javascript/v2/introduction#loadingmap each map contains zoom level, defines resolution of current view. zoom level

symfony - JOIN WITH entity.collection Doctrine 2 -

i've been trying lot of different things can't seem find way join... entity's attribute collection. have users , contacts. because of reasons, want make query such : select c bundle:contact c left join bundle:user u c.user = u c in u.contacts i know query doesn't seem make sense, actual query i'm working on :) so doctrine not accept query expects select...from after in. how make query can check c belongs collection u.contacts? how 1 restrain selection according select in entity's attribute? ok, honest, have no idea trying do. give 2 examples, 1 need or @ least give idea do. first problem; , in conditions doesn't make sense me. if want join users, should this: //contactrepository public function findmesomething() { $subquery = "select s1.id bundle:user s1 ... condition" ; return $this->createquerybuilder("c") ->leftjoin("c.users", "u", "with", "u.id in ($subqu

visual studio 2010 - MFC C++ LNK 2019 ERROR -

i trying "file save as" programming code inside mfc application. in testdlg.h header file have got public: bool savefile (lpctstr pszfile); cstring m_strpathname; and in testdlg.cpp cpp file have got void ctestdlg::onsavefile() { tchar szfilters[] = _t ("text files (*.txt)¦*.txt¦all files (*.*)¦*.*¦¦"); cfiledialog dlg (false, _t ("txt"), _t ("*.txt"), ofn_overwriteprompt | ofn_pathmustexist | ofn_hidereadonly, szfilters); if (dlg.domodal () == idok) { if (savefile (dlg.getpathname ())) m_strpathname = dlg.getpathname (); } } after this, build solution , got error. lnk2019: unresolved external symbol "public: int __thiscall ctestdlg::savefile(wchar_t const *)" (?savefile@ctestdlg@@qaehpb_w@z) referenced in function "public: how resolve this?? appreciated. thank you. edit. after removing if (savefile (dlg.getpathname ()) line, file can build , run when

sql - Conditional sum in Group By query MSSQL -

i have table orderdetails following schema: ---------------------------------------------------------------- | orderid | copycost | fullprice | price | pricetype | ---------------------------------------------------------------- | 16 | 50 | 100 | 50 | copycost | ---------------------------------------------------------------- | 16 | 50 | 100 | 100 | fullprice | ---------------------------------------------------------------- | 16 | 50 | 100 | 50 | copycost | ---------------------------------------------------------------- | 16 | 50 | 100 | 50 | copycost | ---------------------------------------------------------------- i need query surmise above table new table following schema: ---------------------------------------------------------------- | orderid | itemcount | totalcopycost | totalfullprice | ----------------------------------------

javascript - Default selected text areas' position in response to Ctrl+F -

while using browser's default search option(i.e. ctrl+f), highlights matched text/s crating colored background area 'div' or 'textarea'. seems me, highlighted area made through wrapping matched text of display objects of html. if case how position of areas relative screen coordinates.

timeout - Trying to write javascript function to animate scrollTo method -

i new javascript , know if following function should create transition scrolling down set scroll position , if not, misunderstanding time out or scroll methods.. function scrolldowntomovie() { (var scrollbit = 10; scrollbit < 900; scrollbit += 10) { window.settimeout(function({window.scrollto(0,scrollbit);} ,scrollbit*100); } } thank you try this. it's not perfect should want. var scrollbit=10; function scrolldowntomovie() { var time=settimeout(function(){scrolldowntomovie();},50); //fifty can whatever increment want. window.scrollto(0,scrollbit);scrollbit+=10; if(scrollbit>890){cleartimeout(time);} }

java - Barcode location while scanning -

Image
i'm using app redlaser library barcode scanning (which built off zxing, believe). working fine, while in scanning mode, barcode comes within view scanned, don't want that, want barcodes aligned in scanning area considered , rest ignored. the redlaser sample app, after implemented library in own app, had rectangle on layout of scanning activiy, ignored, barcodes part of screen scanned , taken account sample app. bottom line: want scanning activity compare location of detected barcode , see if within bounds of "scanning area", if not won't read. here code adjustment of "scanning area": viewfinderview = findviewbyid(r.id.view_finder); layoutparams params = new layoutparams((int)(mdisplay.getwidth() * .75f), (int)(mdisplay.getheight() * .33f)); params.gravity = gravity.center; viewfinderview.setlayoutparams(params); the following code doesn't anything, wrote exemplify how works (since don

linechart - marker become invisible when line chart negative values in highcharts -

marker of negative value become invisible in line chart type in highcharts my fiddle : http://jsfiddle.net/tntsr/542/ i have tried change plot options seems there no error in plot options. advance thanks { "chart": { "renderto": "container", "reportcode": "container", "defaultseriestype": "line", "events": { } }, "title": { "text": null, "style": { "fontsize": "11px", "fontfamily": "open sans , sans-serif", "fontweight": "normal" } }, "subtitle": { "text": null, "style": { "fontsize": "11px", "fontfamily": "open sans , sans-serif", "fontweight": "normal" } }, "legend": { "floating": false, "

python - webapp2 DomainRoute is not matching -

i'm trying launch webserver serving several sites under several subdomains. i'm using pythen webapp2 , paste. server behind router asigns static ip adress server , forwards port 80. router has no static ip adress assigned isp i'm using ddns (lets example.dlinkddns.com) . in folder hierarchy each folder represents subdomain , python module. like this: server/app.py server/www server/www/__init__.py server/test server/test/__init__.py they should reachable via www.mydomain.com , test.mydomain.com set *.mydomain.com cname example.dlinkddns.com this server/app.py: import sys import os import webapp2 webapp2_extras import routes paste import httpserver domain = 'mydomain.com' class fallback(webapp2.requesthandler): def get(self, *args, **kw): self.response.write('fallback...\n'+str(args)+'\n'+str(kw)) def main(): dirs = [name name in os.listdir(".") if os.path.isdir(name)] dirs.remove('env') # f

jquery - Cannot center on the marker in Google Maps -

i have code below generate google map, map doesn't center @ marker. i've done research can't figure out. the javascript code use: if (status == google.maps.geocoderstatus.ok) { latitude = results[0].geometry.location.lat(); longitude = results[0].geometry.location.lng(); $('#map_canvas').gmap('addmarker', { position: latitude + ',' + longitude, center: latitude + ',' + longitude, zoom: 10, draggable:false }); } try - var c = new google.maps.latlng(latitude , longitude); $('#map_canvas').gmap('addmarker', { position: c , zoom: 10, draggable:false }); $('#map_canvas').gmap({'center': c});

php - making two different class names together in the same h3 tag in code retrieved from remote source -

i working getting html source code remote page removing tbody s the source echo in page works problem stuck @ want put 2 class name in same h3 tag way code can display properly in page <?php //get url $url = "http://lsh.streamhunter.eu/static/section35.html"; $html = file_get_contents($url); $doc = new domdocument(); // create domdocument libxml_use_internal_errors(true); $doc->loadhtml($html); // load html can add $html $elements = $doc->getelementsbytagname('tbody'); $toremove = array(); // gather list of tbodys remove foreach($elements $el) if((strpos($el->nodevalue, 'desktop') !== false) && !in_array($el->parentnode, $toremove, true)) $toremove[] = $el->parentnode; foreach($elements $el) if((strpos($el->nodevalue, 'recommended') !== false) && !in_array($el->parentnode, $toremove, true)) $toremove[] = $el->

opengl - Per-vertex reflection and intersection calculation, OpenCL vs GLSL -

Image
i have calculate visibility field of mirror on plane (i.e: floor). the mirror surface composed of several triangles (up fewer thousands). each vertex define mirror point, each mirror point may correspond 6 triangle vertices , has normal. in order should calculate line between specific point, representing driver head (where blue lines come from), , each of mirror points lying on mirror surface (in image on right side). each of these points, should calculate reflections (yellow lines) based on direction of i-th blue line , i-th normal , therefore intersection between i-th yellow line , floor. both blue , yellow lines need tested intersection vehicle geometry during process.. right whole process run on cpu, approximations in order make faster, original idea move calculation part on opencl.. i came cuda environment (and know opencl similar), learnt opengl, , starting discovering glsl.. given read glsl has limitations compared cuda/opencl, faster , has wider compatibilit

Can Upnp or DLNA stream audio from server to multiple renderers at the same time? -

i know if possible upnp/dlna protocol stream audio single media server multiple media renderers @ same time. protocol allow this? thank you. basically, depends on mean "at same time". possible access same media 2 different dmps. however, each of them creating new stream, means twice traffic. upnp , dlna using http primary streaming protocol. rtp unicast , multicast streams considered not implemented manufacturers because not mandatory. so, multicast streams aren't supported. additionally, servers might implement limitations when accessing file or media, f.e. when have tv tuner or else provides exclusive access specific media (tv channel). then, can access media once @ time.

php - activity 1 shows POST result, activity 2 does not. Explanation? -

the question is: please explain why code works in 1 activity, won't in second? just note: query absolutely fine. i've echo'd query in both occasions , correct. i load page. works. i start "activity 1", filter through database specific search term. my javascript: $('#filter').on("click", function(e) { e.preventdefault(); $( "#dialog-filter" ).dialog( "open" ); }); $( "#dialog-filter" ).dialog({ autoopen: false, resizable: false, height: 100, modal: true }); my html <div id="dialog-filter" title="filter op"> <form id="form_filter" name="form_filter" action="" method="post"> <input type="hidden" name="filter" id="filter" value="filter" /> <table align="center" border="0" cellpadding="0" cellspacing="0"

mysql - Bulk insert statement with unique constraint -

i writing php script need generate unique codes. these codes generated admin user, 100k @ time. have algorithm generates code, there slight chance duplicate mix - 0.001% chance still cause problem. i looking run bulk insert statement: insert coupons ( 'code' ) values ('code1'),('code2'),('code3'); this have 100k codes in it. want know if of them unique except lets code100 insert stop @ code or continue on rest of inserts , let me know warning. if end failing @ first duplicate, can it? performance isn't big issue admin area , can spin process off until completed. if there duplicate found in bulk insert, entire insert fail -- not after duplicate. if performance not issue , doesn't matter if lose of inserts, each insert statement individually. otherwise, update algorithm check duplicates when generates codes.

jni - How to use a C library such as PJSIP on java? -

is there way use , invoke method calls library compiled in c such pjsip library? i want use , invoke calls pjsip lib have compiled obvious issue pjsip c library not java library ie jar file. possible? maybe jni? thanks edit: tried using swig task @ hand create empty class file. here command use execute swig: swig -verbose -java -package com.josh.sip.util -o jni_wrapper.c pjsua.i output swig command language subdirectory: java search paths: .\ .\swig_lib\java\ c:\users\jonney\downloads\swigwin-2.0.9\lib\java\ .\swig_lib\ c:\users\jonney\downloads\swigwin-2.0.9\lib\ preprocessing... starting language-specific parse... processing types... c++ analysis... generating wrappers... pjsua java class creates me: /* ---------------------------------------------------------------------------- * file automatically generated swig (http://www.swig.org). * version 2.0.9 * * not make changes file unless know doing--modify * swig interface file instea

ruby on rails - Why do coffeescript/jquery functions not trigger on DOM elements loaded via ajax, and how to fix? -

in rails 3.2 app have coffeescript function toggles css class when link clicked. #coffeescript jquery -> $(".toggle-link").click -> $(this).toggleclass "selected" #view <%= link_to "toggle", my_path, class: "toggle-link" %> this works fine. but if move link ajaxified partial, e.g. pagination, jquery toggle stops working. why this? and how can fixed? you need use on dynamic elements : jquery -> $(document).on 'click', ".toggle-link", -> $(this).toggleclass "selected" (replace document container of pages better efficiency)

Producing a new line in XSLT -

i want produce newline text output in xslt. ideas? the following xsl code produce newline (line feed) character: <xsl:text>&#xa;</xsl:text> for carriage return , use: <xsl:text>&#xd;</xsl:text>

enumerate - Ruby .detect alternative -

i looking alternative solve following issue: with .detect if looking stringvalue , value given 132stringvalue , still return true. need alternative matching beginning of string. suggestions aside regex? [1] pry(main)> %w[foo 456foo bar 123bar].detect {|e| e.to_i > 0} => "456foo" [2] pry(main)> %w[foo 456foo bar 123bar].detect {|e| e.start_with?('123')} => "123bar"

java - Sending a Notification to Pebble -

i'm trying send notification pebble watch. i'm using code, the example website : public void sendpebble(string title, string body) { final intent = new intent("com.getpebble.action.send_notification"); final map<string, string> data = new hashmap<string, string>(); data.put("title", title); data.put("body", body); final jsonobject jsondata = new jsonobject(data); final string notificationdata = new jsonarray().put(jsondata).tostring(); i.putextra("messagetype", "pebble_alert"); i.putextra("sender", "test"); i.putextra("notificationdata", notificationdata); log.d("test", "sending pebble: " + notificationdata); sendbroadcast(i); } i'm getting message in logcat, no notification on watch. procedure seems simple enough, there obvious missed? or documentation incomplete? edit: obvious questions: yes, watch conn

visual studio 2010 - Load resource as byte array programmaticaly in C++ -

here same question c#: load resource byte array programmaticaly so i've got resource (just binary file - user data, dosen't matter). need pointer byte array representing resource, how ? resource located in resource files of vs2010 (win32 console project). think need use findresource , loadresource , lockresource function of winapi. to obtain byte information of resource, first step obtain handle resource using findresource or findresourceex . then, load resource using loadresource . finally, use lockresource address of data , access sizeofresource bytes point. following example illustrates process: hmodule hmodule = getmodulehandle(null); // handle current module (the executable file) hrsrc hresource = findresource(hmodule, makeintresource(resource_id), resource_type); // substitute resource_id , resource_type. hglobal hmemory = loadresource(hmodule, hresource); dword dwsize = sizeofresource(hmodule, hresource); lpvoid lpaddress = lockresource(hmemory);

null - iOS Bounds of UIView in ViewDidLoad -

i wanted use bounds of uiview create uilabel , add uiview inside viewdidload method, however, have found bounds of uiview still null inside viewdidload. when @ demo app, bounds of uiview initialised in viewdidload. in interface have @interface viewcontroller : uiviewcontroller @property (weak, nonatomic) iboutlet uiview *promotionview; @end and trying do - (void)viewdidload { [super viewdidload]; uiview *container = [[uiview alloc] initwithframe:self.promotionview.bounds]; uilabel *label = [[uilabel alloc] initwithframe:cgrectmake(10, container.bounds.size.height-100, 320, 20)]; label.text = @"promotion title"; [container addsubview:label]; [self.promotionview addsubview: container]; } but doesn't work because bounds of promotionview null. you can in viewdidappear: -(void)viewdidappear:(bool)animated { static int first = 1; if (first) { uiview *container = [[uiview alloc] initwithframe:self.promotionview.bo

How to hide elements with specific attribute values with Jquery -

i have list this <ul> <li language="english"> australia </li> <li language="english"> america </li> <li language="french"> france </li> <li language="french"> canada </li> <li langauge="german"> germany </li> </ul> i want filter , display list having language english. how can achieve using jquery? and strategy if li has multiple attributes <li language="english,french"> canada </li> , want display canada both english french language speaking country. appreciate if post exact code played hide() , not() while now. something this: <li language="english"> australia </li> <li language="english"> america </li> <li language="french"> france </li> <li language="french english"> canada </li> <li langauge="german"> germany <

ios - Can I use NSLayoutConstraints to keep a UIView's subviews equally spaced regardless of later adding or removing from the subviews array? -

i'd have uiview where, every time add or remove subviews subviews array, whichever subviews happent in array still equally spaced. for example, if have subviews , b spaced 10 points appart, so: [a]-10-[b] and add view c, views in subviews should automatically laid out this: [a]-10-[b]-10-[c] if, remove view b, gap in between , c should update once again 10 points: [a]-10-[c] i know can use nslayoutconstraint create type of constraint between 2 known views, , guess set kvo each time array changes cycle through subviews , re-apply constraint i'm wondering if there automatic way of doing it. make sure code calculates constraints based on current subviews in updateconstraints: - (void)updateconstraints { [super updateconstraints]; // put code here } then need call setneedsupdateconstraints whenever add/remove subview.

How to get phone number of SMS recipient in Android -

i have seen many questions asking how sms sender's phone number, not recipient's phone number. have used tool on site generate pdu , can see recipient's phone number in it: useful pdu details , pdu translation tool however, don't see anywhere in smsmessage class provided android can recipient's phone number. reason want have dual sim phone, don't see anywhere in android can determine sim port being used incoming sms. @ least, want @ each sms message , determine phone number sent to. this question seems similar mine no answers: how sms recipient's phone number in android my question different because have detailed link site pdus, may useful extracting phone number form raw pdu bytes smsmessage class provides. any ideas? it depends point watch sms message. sms pdu lies on top of map protocol. when send sms message, phone puts recipient number in tp-destination within pdu, when receive sms message, there no recipient number anywher

cuda - Number of threads in a block -

i used x & y calculating cells of matrix in device. when used more 32 lena & lenb, breakpoint (in int x= threadidx.x; in device code) can't work , output isn't correct. in host code: int lena=52; int lenb=52; dim3 threadsperblock(lena, lenb); dim3 numblocks(lena / threadsperblock.x, lenb / threadsperblock.y); kernel_matrix<<<numblocks,threadsperblock>>>(dev_a, dev_b); in device code: int x= threadidx.x; int y= threadidx.y; ... your threadsperblock dim3 variable must satisfy requirements compute capability targetting. cc 1.x devices can handle 512 threads per block cc 2.0 - 3.5 devices can handle 1024 threads per block. your dim3 variable @ (32,32) specifying 1024 (=32x32) threads per block. when exceed getting kernel launch fail. if did cuda error checking on kernel launch, see error. since kernel doesn't launch type of error, breakpoints set in kernel code won't hit.

jquery - waitForKeyElements doesn't recognize selector, with "$"? On reload of same id? -

so trying use waitforkeyelements() function in order detect ajax content. div trying select has "$" in id (e.g. <div id="mydiv$0"> ) , after trial , error 90% sure causing problem. function doesn't work. how fix this? also question regarding how waitforkeyelements() function works. site has dropdown in select option. each option load table same id's , classes, different content. would function recognize new table loading? this 2 questions, in one. first answered blender ; must escape $ characters in id. so, <div id="mydiv$0"> , use like: waitforkeyelements ("#mydiv\\$0", youractionfuntion); answer second question: each option load table same id's , classes, different content. (waitforkeyelements) recognize new table loading? is: it depends. is page deleting , re-adding element? if so, use waitforkeyelements() normally. is page changing content of element? best approach varies