Posts

Showing posts from March, 2014

python - PySide QML project on android -

i have made application on pyside , qml pc , interested know how can run on android tablet. p.s.: program uses socket, threading , mongodb too. i think big answer , redundant such. point directly link : http://qt-project.org/wiki/pyside_for_android_guide also google 'necessitas' further information.

Change of Data in a ListView in Android -

i have list view populated data.i need change data in listview on click of button.now problem data associated adapter getting changed same not getting changed in ui. when change orientation landscape portrait,the new data getting displayed.can suggest solution this. thanks in advance. call notifydatasetchanged() on listadapter . when changing orientation works because default on orientation change, activity gets destroyed , recreated, recreating list adapter.

curl - Scrape facebook fan page in PHP -

i'm trying scrape facebook fanpage using curl in php give's me blank page. here code. function curlfunction($source_url){ $ch = curl_init(); $useragent = 'mozilla/5.0 (windows nt 6.1; wow64; rv:15.0) gecko/20100101 firefox/15.0.1'; curl_setopt($ch, curlopt_useragent, $useragent); curl_setopt($ch, curlopt_url, $source_url); curl_setopt($ch, curlopt_header, false); curl_setopt($ch, curlopt_failonerror, true); curl_setopt($ch, curlopt_encoding, "utf-8" ); curl_setopt($ch, curlopt_followlocation, true); curl_setopt($ch, curlopt_autoreferer, true); curl_setopt($ch, curlopt_returntransfer, true); curl_setopt($ch, curlopt_timeout, 60); $html= curl_exec($ch); curl_close($ch); return $html; } $token = "caacedeose0cbadmek5ullfstj1nzcg8eogazbi6dfkr4gjn9o6ffuyfehkpto94br9i9yp9gmiypunhxrxr1pqu3yny34pziacweamxl4nt9zzbmgdwd6wfh6mal2dlqsjnys9skq5sz7zcvbn7za8lvrzcjrq8o0zd"

cocoa touch - Multiple rounded-corner rows per UITableView section -

i know if create uitableview grouped sections , 1 row per section, each row rounded corners, need more 1 row per section, each row still having rounded corners. how do that? you can manipulate cell's calayer property #import <quartzcore/quartzcore.h> [cell.layer setcornerradius:5.0f]; [cell.layer setmaskstobounds:yes]; [cell.layer setborderwidth:2.0f];

php - give page user control over where condition -

hi im new php , have little knowledge, in statement have status='a' , z.zoneid=1, there way give page user control on z.zoneid=1 can change zoneid available, maybe through drop-down list? ////////query & data display here///////// $q=mysql_query("select r.*, f.functionname, m.managername, z.zonename requests r inner join functions f on r.functionid = f.functionid inner join managers m on r.managerid = m.managerid inner join zones z on r.zoneid = z.zoneid status='a' , z.zoneid=1 order functionname"); echo "<table> <tr> <th>function</th> <th>manager</th> </tr>" ; while($nt=mysql_fetch_array($q)){ echo"<b>zone: $nt[zonename]<br>capacity: $nt[zonecapacity]</b><br><br>"; echo "<tr><td>$nt[functionname]</td><td>$nt[managername]</td></tr>"; } echo "</table>"; /////////////////////////////////////

python - Bigrams with NLTK: problems with script -

i trying "calculate" bigrams in corpus nltk. however, there still bugs in script seems. can't figure out doing wrong, hope able give me @ least clue. please keep in mind, new this. thanks! tekst.collocations() bgm = nltk.collocations.bigramassocmeasures() finder = bigramcollocationfinder.from_words(mijn_corpus) # mijn_corpus should it's loc finder.apply_freq_filter(3) # filter out ones appear 1,2 times finder.nbest(bgm.pmi, 10) scored_bgm = finder.score_ngrams( bgm.likelihood_ratio ) prefix_keys = collections.defaultdict(list) key, scores in scored: # sorting on first word of bigram prefix_keys[key[0]].append((key[1], scores)) key in prefix_keys: #strongest association prefix_keys[key].sort(key = lambda x: -x[1])

c++ - Bit Shifting in Cache Simulation -

what formula calculating index , tag bits in direct mapped cache associative cache set associative cache i using formula direct mapped: #define block_shift 5; #define cache_size 4096; int index = (address >> block_shift) & (cache_size-1); /* in line above want "middle bits" block goes */ long tag = address >> block_shift; /* high order bits tag */ please tell me how many bits shifted in associative , set associative cache.. so, think concrete answer question "zero", that's because asking wrong question. right, cache given size x, directly mapped, use lower part [or other part(s)] of address form index cache. index value between 0 , (chace-size-1). in other words, "address modulo size". since sizes of caches 2 n , make use of fact both of these can performed using simple bitwise "and" (size-1) instead of using divide. in code, each cache entry (cache-line) holds "block" of 32 bytes, addre

c - Expected a Declaration -

this first question (quite new coding) try , include info possible 'cos right i'm stumped! i'm attempting write code create butterworth filter fit user input specifications. i'm using code composer 4. having google away 54 errors have persistent 1 left: "expected declaration" on line 27: if (n=1 && hpf=0) i have triple checked curly brackets, ideas? edit: hi again, help. have sorted old problems , more since have hit brick wall again; code won't write on (or create if file deleted) coffic.cof file. no errors appear file remains same. idea? p.s. sorry previous code layout - better: #include "dsk6713_aic23.h" //codec-dsk support file uint32 fs=dsk6713_aic23_freq_8khz; //set sampling rate # include <stdio.h> # include <math.h> # include <stdlib.h> #define pi 3.1415927 #include "coffic.cof" void main() { double hpf, fs, fco, atn, fat, tp, k, ad, m, n, o, da, db, dc; file *fp;

c# - BindingSource.Filter ignoring one of my conditions -

i have bindingsource filter multiple conditions. reason have single search_textbox find specific record... i have 1 problem though, have more permanent condition" status ' {0} ' and... ", once type anything, restriction ignored. assumed 'and' take care of that, apparently mistaken. bs.filter = string.format("status '*{0}*' , customer_code '*{1}*' or customer_name '*{1}*' or customer_jobnumber '*{1}*' or customer_date '*{1}*' or order_number '*{1}*'", select, textbox1.text); any advice? kindly herman vercuiel edit: sorry, should have mentioned recurring inside textchanged event.. don't need add couple of parenthesys around conditions? bs.filter = string.format("status '*{0}*' , ( customer_code '*{1}*' " + "or customer_name '*{1}*' or customer_jobnumber '*{1}*' " + &quo

python - Simple torrent client with PyQt -

recently have started python practice. it's useful pl, when you're using linux. here's problem: simplicity of qt , power of python has overgrown me little bit. want build simple torrent client using pyqt , libtorrent. i've got ready use code of downloading 1 torrent @ time. although, i'm having trouble integrating app code qt's code. here's code of torrent.py: #!/usr/bin/python import sys pyqt4 import qtcore, qtgui import libtorrent lt import time from torrent_ui import ui_form, ses class myform(qtgui.qmainwindow): def __init__(self, parent=none): qtgui.qwidget.__init__(self, parent) self.ui = ui_form() self.ui.setupui(self) if __name__ == "__main__": app = qtgui.qapplication(sys.argv) myapp = myform() myapp.show() ses.listen_on(6881, 6891) #e = lt.bdecode(open("test.torrent", 'rb').read()) info = lt.torrent_info("g.torrent") h = ses.

gruntjs - grunt-contrib-jshint doesn't complain about console.log -

with following setting jshint doesn't complain console.log statements while still reports debugger statements: jshint: { files: [ 'gruntfile.js', 'js/**/*.js', 'tests/*.js', ], options: { curly: true, immed: true, noarg: true, expr: true, quotmark: 'single', maxdepth: 3, browser: true, eqnull: true } }, as far can tell, jshint has never warned references console . there no code in there handle such references. console treated identifier should defined , accessible whatever context referred (which correct, since is). therefore, can jshint warn usage of console getting warn undefined variables. set undef option true . then, if want allow usage of console , can add globals directive or set devel option true (which implicitly adds globals directive).

Update table based on the query returned in SQL Server -

i stuck update query. have query as select s_no, loan_id,repayment_date,principal,loan_balance, count(*) repeattimes loan_repayment_plan_mcg group s_no, loan_id, repayment_date,principal,loan_balance having count(*) > 1 it returns output: s_no loan_id repayment_date principal loan_balance repeattimes 1 21111 2012-03-13 0.00 5000.00 2 2 21311 2012-04-12 0.00 2000.00 2 3 21111 2012-05-13 500 5000.00 2 4 21111 2012-06-14 0.00 5000.00 3 i want update loan_balance multiplied repeattimes above select query based on loan_id , repayment_date combines make unique row. the traditional way, using update join update set loan_balance = loan_balance * repeattimes loan_repayment_plan_mcg join ( select s_no, loan_id,repayment_date,principal,loan_balance, count(*) repeattimes loan_repayment_plan_mcg group s_no, loan_i

sql - using a case statement inside a string -

i need put case statement in string. how can achieved? select datediff(mm, select case fa.new_ownertype when 8 fa.new_vlenrollmentstartdate else fa.new_contractstartdate bingmapsplatform_stagging.dbo.filteredaccount fa end, getdate()) select datediff(mm, case fa.new_ownertype when 8 fa.new_vlenrollmentstartdate else fa.new_contractstartdate end, getdate()) bingmapsplatform_stagging.dbo.filteredaccount fa

command line arguments - Gradle build: does someone tried alternative build script with alternative setting.gradle? -

i using gradle 1.4, , renamed build.gradle buildexpr.gradle , settings.gradle settingexpr.gradle, both files in project root, , using following command run gradle build. 'gradle c:\myproject>gradle -i -b buildexpr.gradle -c settingsexpr.gradle project' it seems command line option '-c' not being honored , gradle not picking settingsexpr.gradle file, hence not able display modules defined in settings.gradle file while executing project task. i getting following log -------------------------------------log---------------------------------------------------- c:\asm\asm_workspace\asm71\autolab>gradle -i -c settingsexpr.gradle -b buildexpr.gradle project starting build settings evaluated using empty settings script. projects loaded. root project using build file 'c:\asm\asm_workspace\asm71\autolab\buildexpr.gradle'. included projects: [root project 'autolab'] evaluating root project 'autolab' using build file 'c:\asm\asm_workspac

Javascript parsing json date timezone return one day earlier in British Standard Time -

i have used below code date. function parsejsondate(jsondate, dateformat) { var offset = new date().gettimezoneoffset() * 60000; var parts = /\/date\((-?\d+)([+-]\d{2})?(\d{2})?.*/.exec(jsondate); if (typeof dateformat == 'undefined') { dateformat = 'mm/dd/yyyy h:mm'; } if (parts[2] == undefined) parts[2] = 0; if (parts[3] == undefined) parts[3] = 0; return new date(+parts[1] + offset + parts[2] * 3600000 + parts[3] * 60000).format(dateformat); }; but function returns 1 day earlier in british standard time. while input json date in correct. can me fix issue.

How to split a string which is separated by an Element in PHP -

i have variable containing date , time has been separated element " t " $date_time="2013-05-05t18:30:00"; now want date in 1 variable , time in variable below. $date="2013-05-05"; $time="18:30" if trying split it, can use explode() along list() list($date, $time) = explode('t', $date_time); echo "date: $date time: $time"; you may want in php's datetime class if you're looking processing this.

android - Best way for Uploading a large audio file max of 200mb to server via webservice? -

i need upload large audio file max of 200mb server via webservice. reading whole file runtime memory real pain, hope so. think best way stream file , upload server randomaccessfile. can tell me, possible way? if not how can tackle problem?

java - Which solution has better performance when counting with hibernate -

i have 2 entities.one product , other productcategory.product productcategory relationship many one.i have method productcategories.i want add transient variable productcount productcategory shous how many products available each productcategory.i have 2 solutions these.both working fine. solution 1 public list<productcategory> getproductcategorylist() { list<productcategory> productcategorylist = .getcurrentsession() .createquery( "select pc productcategory pc") .list(); (productcategory category : productcategorylist) { string categoryid = category.getid().tostring(); category.setproductscount(getcurrentsession() .createquery( "select p product p p.productcategory.id=:categoryid") .setparameter("categoryid", long.parselong(categoryid)) .list().size()); } return productcategorylist;

iphone - UITableView: table view scrolling makes images disappear -

i working 1 ios application has 2 tables placed side side, each table view holds images. both table views having auto scrolling , manual scrolling functionality. default both tableviews in auto scrolling mode, problem when user did manual scrolling images in table view become disappear (loading images lately) , happening when table view state moving auto scrolling manual scrolling , manual scrolling auto scrolling. using static images (not dynamic , not server). in future have use dynamic data(images) coming server. any ideas fix issue helpful me. check size of uitableviewcells , subviews. (at least me) sizes @ 0 , when frame (which 0 points high) goes off screen, image disappear.

java - How to change color of cell in JTable and animate it? -

i have jtable numbers. know how change color of 1 cell or cells. how change color of cell in , animate ? example, first cell of red, there delay, , second cell painted in same red color , on. i inherited class defaulttablecellrenderer class paintcell extends defaulttablecellrenderer { public component gettablecellrenderercomponent(jtable table, object value, boolean isselected, boolean hasfocus, int row, int column) { component c = super.gettablecellrenderercomponent(table, value, isselected, hasfocus, row, column); return c; } } and set method table.setdefaultrenderer(object.class, new paintcell()); private jtable table; private int index; private void startanimation() { timer timer = new timer(1000, new actionlistener() { @override public void actionperformed(actionevent e) { index++; if (index > table.getrowcount() * table.getcolumncount())

java - ApplicationInfo metadata returning null -

i have following code: in manifest: <meta-data android:name="com.facebook.sdk.applicationid" android:value="@string/facebookapplicationid" /> in code: applicationinfo ai = getpackagemanager().getapplicationinfo( getpackagename(), packagemanager.get_meta_data); if (ai.metadata != null) { ... but result ai.metadata==null. why happening from latest android doc, <meta-data> can contained in <activity>/<activity-alias>/<service>/ <receiver>. should append meta-data in these components, not in <application> directly.

c++ - What is the right way to handle char* strings? -

i have third party library using char* (non-const) placeholder string values. right , safe way assign values datatypes? have following test benchmark uses own timer class measure execution times: #include "string.h" #include <iostream> #include <sj/timer_chrono.hpp> using namespace std; int main() { sj::timer_chrono sw; int iterations = 1e7; // first method gives compiler warning: // conversion string literal 'char *' deprecated [-wdeprecated-writable-strings] cout << "creating c-strings unsafe(?) way..." << endl; sw.start(); (int = 0; < iterations; ++i) { char* str = "teststring"; } sw.stop(); cout << sw.elapsed_ns() / (double)iterations << " ns" << endl; cout << "creating c-strings safe(?) way..." << endl; sw.start(); (int = 0; < iterations; ++i) { char* str = new char[strlen(&qu

android - how to build BufferReceived() to capture voice using RecognizerIntent? -

i working on android application using recognizerintent.action_recognize_speech,,, problem don't know how create buffer capture voice user inputs. read alot on stack overflow, don't understand how include buffer , recognition service call code. , how play contents saved buffer. this code: public class voice extends activity implements onclicklistener { byte[] sig = new byte[500000] ; int sigpos = 0 ; listview lv; static final int check =0; protected static final string tag = null; @override protected void oncreate(bundle savedinstancestate) { // todo auto-generated method stub super.oncreate(savedinstancestate); setcontentview(r.layout.voice); intent intent = new intent(recognizerintent.action_recognize_speech); intent.putextra(recognizerintent.extra_language_model, recognizerintent.language_model_free_form); intent.putextra(recognizerintent.extra_calling_package, "com.domain.a

windows runtime - Modifying GridView to work with only One group and multiple items within that group -

i trying customize gridview prebuilt template. default has multiple groups , multiple items within each group. i have single group , multiple items group. how can configure gridview work needs. can please let me know of online resource or suggestions? if have 1 group, don't have groups. suggestion use gridview , not use grouping. so, don't tell collectionviewsource group data, since not grouping - might bind list directly. then "group heading" can placed in header property of gridview or above in ui if want. again, not have group in gridview , sounds don't want anyway. not mean lose functionality. best of luck!

css - Center Div Tags in another Div Tag -

Image
i'm trying parent div tag hold n children div tags such on same line, yet grouped in center. example: here children blue, , parent red. here things i've tried: making blue divs display:inline them on same line. problems: doesn't display width , height both set 10px.i tried adding &nbsp; , couple pixels wide. making blue divs float:left. problems: have programmatically resize red parent child contents since divs floated , center in parent want. there should solution doesn't involve javascript. <style> .container { width: 100%; padding: 0; text-align: center; border: 1px solid red; } .inner { display: inline-block; margin: 0 5px; border: 1px solid blue; } </style> <div class="container"> <div class="inner"> 1 </div> <div class="inner"> 2 </div> <div class="inner"> 3 </div> </div>

php - Price mark is showing up twice -

on virtuemart (joomla) noticing on each of items price showing twice. once in english , once in french. believe has language extension, know how can fix this? i using latest versions of joomla , virtuemart. thank in advance.

microsoft metro - Message Dialog not displaying on Windows 8 tablet - Caliburn.Micro/C# -

has heard of issues messagedialog's not displaying on windows 8 tablets? or more samsung 700t? uses regular intel process , not arm. built app on laptop , messagedialog shows when debugging laptop, shows on tablet simulator doesn't show on actual tablet. i'm using caliburn.micro iresult interface display messagedialog in view. heres snippits of code i'm using: public ienumerable<iresult> navexecute(string method) { windows.ui.viewmanagement.applicationview.tryunsnap(); var conn = networkinformation.getinternetconnectionprofile(); if (conn.getnetworkconnectivitylevel() != networkconnectivitylevel.internetaccess) { yield return new messagedialogresult("internet connection not detected", "connection error"); neton = false; } } above in view model base class, , heres implementation of iresult class itself: public class messagedialogresult : resultbase { private readonly string _content; pri

Entity Framework Code First - Two tables, same concept, but different types -

i have database 2 tables, 1 column numeric (19,4) , other float. need map (in entity framework 5 code first) 2 tables in entities have same type, such decimal. change database best solution, although out of question. anyone? entity framework not support such simple mappings (yet?) require type conversions. on feature request list apparently not decided until if simple type mappings better support in future: http://data.uservoice.com/forums/72025-entity-framework-feature-suggestions/suggestions/2639292-support-for-simple-type-mapping-or-mapped-type-con a workaround use two properties in model, 1 not mapped database column , 1 type matching actual type in database, , perform type conversion between 2 properties in getters , setters. example here: https://stackoverflow.com/a/14221906/270591

web applications - Understanding Session Expiration -

looking @ owasp session management cheat sheet , every time session expires, must user go through same pre-auth --> auth --> ... steps make new session? for example, if session expires , web app requires authentication, user have log web app before getting new session? sessions maintained cookies. http stateless protocol. every request server works in isolation. no request has information previous request. say user named a logs in site. site works session , sets session data user. internally server creates value , associates particular user. value 12345 computed , associated user a . server decides give value's name sessionid . sends sessionid in cookie , cookie stored on user's browser. next time user a makes request cookie sent server. server reads cookie sessionid , , finds it. sees user value in cookie i.e 12345 associated. finds value associated user a , user a , making request. say cookie expires, can various reasons. either user deletes

html - Positioning Div horizontally -

im trying position 3 div block horizontally 3 block positions on new line. when resizing them not move. .left1 { padding: 9px; border: 1px solid #e7e7e7; float: left; margin-right: 40px; text-align: center; } .left2 { padding: 9px; border: 1px solid #e7e7e7; float: left; margin-right: 40px; } .right1 { padding: 9px; border: 1px solid #e7e7e7; float: left; margin-right: 40px; } rest of code http://jsfiddle.net/ewur8/ the boxes wide container. recreated here using 3 blocks , works fine. reduce container width. http://jsfiddle.net/zy4cn/ .block1,.block2,.block3{ float:left; padding: 9px; border: 1px solid #e7e7e7; float: left; margin-right: 40px; } .nomarg{margin-right:0!important;}

jQuery Mobile select "twitches" to first item after opening for some time -

i'm having issue annoying "twich" when trying select option using jquery mobile. to reproduce issue: see: http://jsfiddle.net/4axh8/ <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.css" /> <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script> <script src="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js"></script> <select name="select-choice-1" id="select-choice-1"> <option value="standard">standard: 7 day</option> <option value="rush">rush: 3 days</option> <option value="express">express: next day</option> <option value="overnight">overnight</option> </select> open select menu. hover mouse on "overnight" option. wait ~2 seconds, observe goes "standard: 7 day" optio

c++ - Exiting While Loop immediately after the last word in a line -

i reading following line file using fgets: #c 1 2 3 4 5 6 7 8 9 ten eleven each word (except #c) column heading. there eleven columns in file. my aim divide line tokens of each word. also, need count there 11 column headings. (there can more or less column headings 11) my problem spaces @ end of line. here code using: while(1){ fgets(buffer,1024,filename); if (buffer[1] == 'c'){ char* str = buffer+2; char* pch; pch = strtok(str," "); while(pch != null){ pch = strtok (null, " "); if (pch == null)break; //without this, ncol contains +1 //amount of columns. ncol++; } break; } } this code gives me ncol = 11. , works fine.(note there single space @ end of line reading) however, if have no space @ end of line, gives ncol = 10 , not read last column. my aim ncol =11 regardless of whether there spaces @ end of not. want read last word, check if there more word ,

postback - How to get textbox value in ASP.NET click eventhandler -

somehow 1 of stored procedures stopped executing aspx page. works if run sql server using exec . when click button on aspx page assigns parameters , values, , launches procedure, page reloads data not updated. button can run create or update procedure, depending on page parameters in address bar. nothing executed. in aspx page create button this: <asp:button id="btnsavechanges" runat="server" class="class_button normal enabled" onclick="btnsavechanges_click" text="save changes" width="100" /> then in code-behind file: protected void btnsavechanges_click(object s, eventargs e) { //if (page.isvalid) //{ sqlcommand sqlcomm1 = new sqlcommand(); sqlconnection sqlconn1 = new sqlconnection("server=localhost\\sqlexpress;database=testdb;integrated security=true"); sqlconn1.open(); if(param_id == 0) { sqlcomm1 = new sqlcommand("dc

WCF Fault Exception not being propagated to client -

i have wcf service defines faultcontract: [operationcontract] [faultcontract(typeof(invalidoperationexception))] [faultcontract(typeof(notsupportedexception))] [faultcontract(typeof(exception))] getsysidsresponse getsysids(string id); the wcf service catches exceptional case (null pointer exception) , throws faultexception: try { .... } } catch (invalidoperationexception ex) { // specified directoryentry not container throw new faultexception<invalidoperationexception>(ex); } catch (notsupportedexception ex) { // search not supported provider being used throw new faultexception<notsupportedexception>(ex); } catch (exception ex) { throw new faultexception<exception>(ex); } it throws last one. thing never gets client. first o9f all, "fault contracts published part of service metadata

Issue in sending a SOAP request in ApacheHttpClient with SSL -

i want send soap request through ssl soap server (microsoft iis server). when test soap request through soapui tool ssl - keystore configurations returns response correctly. using following code returns "http/1.1 400 bad request" used httpclient-4.2.3 , httpcore-4.2.2. import java.security.keystore; import org.apache.http.header; import org.apache.http.httpentity; import org.apache.http.httpresponse; import org.apache.http.client.methods.httpget; import org.apache.http.client.methods.httppost; import org.apache.http.conn.scheme.scheme; import org.apache.http.conn.scheme.schemeregistry; import org.apache.http.conn.ssl.sslsocketfactory; import org.apache.http.entity.stringentity; import org.apache.http.impl.client.defaulthttpclient; import org.apache.http.impl.conn.basicclientconnectionmanager; import org.apache.http.params.basichttpparams; import org.apache.http.params.httpparams; import org.apache.http.util.entityu

asp.net mvc - How do I inject an HTTP-Request-specific object into my Unity supplied object? -

for example, store "current user" in session. business-layer object being instantiated unity. how make business-layer object aware of "current user"? you should hide "current user" behind abstraction: public interface icurrentuser { string name { get; } } this abstraction should defined in business layer , need create asp.net specific implementation place in composition root : public class aspnetcurrentuser : icurrentuser { public string name { { return httpcontext.current.session["user"]; } } } now business-layer object can depend on icurrentuser interface, , in unity can register implementation follows: container.registertype<icurrentuser, aspnetcurrentuser>();

internet explorer 10 - Float Tags in IE10 not working as expected -

so...having issue ie10 , believe float tags. have page has multiple rows of thumbnail images re-flow according window size using float tags. pretty kewl. images great in every browser; images re-stack , flow nicely...except in ie10. in ie10 nice, neat rows , columns of thumbnail images gone. instead, 1 row of thumbnail images in 1 row (no columns) jet off across page inside container, on 150 images not view-able, first few thumbnails of first row. ie10 ignoring float. not sure how fix this. i've heard of flex boxes fix won't work on other browsers. not sure how fix this. , keep in mind new css...here's code: @charset "utf-8"; /* css document */ div.img { margin: 3px; border: 3px solid #7e8baf; height: auto; width: auto; float: left; text-align: center; padding: 2px; background-color: #2ebbea; clear: right; } div.img img { display: inline; margin: 3px; border: 1px solid #ffffff; text-align-last: end

angularjs - Angular directives collaboration -

so here trying implement autocomplete suggestion angular , need expertise. here html: <div my-autosuggest> <input type="text" my-autosuggest-input> <ol> <li ng-repeat"item in items" my-autosuggest-list>...</li> </ol> </div> i don't want use templates generate <li> elements. (i want flexible use kind of element in order , maybe other elements in between list , dropdown) the hard part respond arrow keys on input highlight next/prev element in list. how let other directive my-autosuggest-list know should select next element my-autosuggest-input directive. note might have multiple autosuggests in 1 controller this: <div ng-controller="mycontroller"> <div my-autosuggest> <input type="text" my-autosuggest-input> <ol> <li ng-repeat"item in items" my-autosuggest-list>...</li> </ol

c# - How to place a self created bitmap in the html body of a mail -

to specify question: i'm creating bitmap object, want send email. don't want save before or upload webserver. attach , link attachement in html body of mail. i've searched quite time , can find answers in picture stored in file system or on server. so there way whithout saving image before? thanks edit: i've tried around bit , came solution: mailmessage mail = new mailmessage(); mail.to.add(new mailaddress("xxx@yyy.de")); mail.from = new mailaddress("xxx@yyy.de"); smtpclient sender = new smtpclient { host = "smtp.client", port = 25 }; mail.subject = "test"; body= "blablabla<br><img alt=\"\" hspace=0 src=\"cid:imagedid\" align=baseline border=0 ><br>blablabla"; alternateview htmlview = alternateview.createalternateviewfromstring(body,

forms - How to move the cursor in a DataGridView c# -

how move cursor in datagridview? no. .selected = true; puts cell in blue default! want cursor move when click on "add" button, want cursor moves last row , last column i use : this.dgridview.rows[nbr].cells[0].selected = true; this.dgridview.beginedit(true); but doesn't work thanks well, if mean in datagridview first row still remains being selected while don't want be, can use currentcell property: private void form1_load(object sender, eventargs e) {//for example, in _load method /*some code here, grid initialization*/ /*...*/ //set selectionmode property in fullrowselect, needs installed //this approach work datagridview1.selectionmode = datagridviewselectionmode.fullrowselect; datagridview1.currentcell = datagridview1.rows[i].cells[i]; }

javascript - Jquery $(window).load not working as expected when in script referenced from inside an iframe -

i have page iframe. trying load animations iframe. each piece of content html page references javascript/jquery scripts soem sort of animation. example: content.html <head> <link rel="stylesheet" type="text/css" href="css/slide.css"> <script src="js/library/big_slide_img.js"></script> </head> <body> <img class="big_slide_img" src="http://25.media.tumblr.com/0ab6f805c5a3591168e2fe2133552054/tumblr_mk52iuvbni1s631nvo1_1280.jpg"> </body> big_slide_img.js $(window).load(function() { $("#iframe").contents().find('.big_slide_img').animate({left: '-=521'}, 800,function(){}); }); how loaded loadslide = function(slide_no) { $.ajax( { url: "http://myurl.com", async: false, jsonpcallback: 'jsoncallback', contenttype: "application/json",

javascript - WebGl Object literal not working -

the basic issue can't example work in object literal - , don't errors in console not reayll sure why doesn't want run. i know code works if use normal functions , not object literal notation maybe have messed scope somewhere or should use object constructors? i had around , couldn't see issues relating using webgl within object literal presume have dodgy coding going on. i have submitted jsfiddle inspect - please ignore cross domain issue of texture. http://jsfiddle.net/j6rmd/ var mycube = { container : null, renderer : null, scene : null, camera : null, cube : null, animating : null, light : null, mapurl : null, map : null, material : null, geometry : null, animating : false, onload : function(){ this.container = $("#container");

ruby on rails - How Do I pass parameters with a render call? -

this simple question. if form isn't filled out correctly, call render 'new' in create action person can fill out form correctly. unfortunately, causes loss of parameters in url. how pass them along render call? your action method should pick parameters , assign instance variable. model in example called note. def create @note = note.new(params[:note]) respond_to |format| if @note.save format.html { redirect_to @note, notice: 'note created.' } else format.html { render action: "new" } end end end the instance variable visible within view: <%= form_for(@note) |f| %> <%= f.text_field :name %> <%= f.submit %> <% end %>

Unknown Issue using Arduino, Xbees and Capacitive Sensor -

i'm having issue current set up. i'm looking activate light on arduino 1 when capacitive sensor's (coiled wire) value goes above 100 on arduino 2. want activate light on arduino 2 when capacitive sensors value on arduino 1 exceeds 100. imagine if coil gameshow buzzer , led has light other contestants. i've used serial.println check how sensors operate. the problem i'm getting when use code: #include <newsoftserial.h> #include <capacitivesensor.h> newsoftserial myport(2,3); capacitivesensor cs_6_4 = capacitivesensor(6,4); // 10m resistor between pins 4 & 2, pin 2 sensor pin, add wire , or foil if desired int incomingbyte; void setup() { cs_6_4.set_cs_autocal_millis(0xffffffff); // turn off autocalibrate on channel 1 - example serial.begin(9600); myport.begin(9600); pinmode(9,output); } void loop() { long start = millis(); long total1 = cs_6_4.capacitivesensor(30); if (

empty space validation in PHP with a for loop -

as can see, have simple registration form, , php script validate fields. idea here is, if have 20+ fields, , required at-least user fill .. username, lastname , age , store in array have done below. $needed = array("username", "lastname", "age"); so, can see in code, for loop check if 1 of them filled, code works part. ex: if don't fill 3 fields you must fill username continue you must fill lastname continue you must fill age continue but, if fill on field , left other two, or fill 2 , leave one, echo '<p>required fileds filled</p>'; so, problem here that, fields should filled before script can go saying echo '<p>required fileds filled</p>'; <pre> <form action='' method='post'> <input type='text' name='username' /> <input type='text' name='lastname' /> <input type='text' name='age&#

javascript - creating dynamic playlist by reading songs from a table using jquery for the jPlayer -

i using jplayer website. now, want create playlist table path , artist names. did added table page , now, using foreach tried read path , add playlist. somehow confused.. have code used grabbing path , works fine <script type="text/javascript"> $(document).ready(function () { $('#songspathgridview tr').each(function () { if (!this.rowindex) return; // skip first row var path = this.cells[0].innerhtml; alert(path); }); }); </script> and playlist have (hard coded values). if in html or have appended path since it's jquery code please tell me how it.. here playlist code <script type="text/javascript"> $(document).ready(function () { var songname = "song1"; var theartist = "the artist"; var myplaylist = [ { mp3: 'music/mad.mp3', oga: 'mix/1.ogg', title: songname, artist: th

java - Trying to check web content on android during Robotium test -

my application service running on background , making changes network traffic. want make test robotium calling web source , checking the page. here code calling web content: intent = new intent(intent.action_view); i.setdata(uri.parse(url)); log.d(tag, "looking text ["+expected+"] @ address ["+url+"]"); getsolo().getcurrentactivity().startactivity(i); getsolo().waitforwebelement(by.textcontent(expected), timeout, false); here few things have tried no result bool foundcontent = getsolo().waitfortext(expected)); foundcontent = foundcontent | getsolo().getcurrentwebelements().size() > 0; foundcontent = foundcontent | getsolo().getwebelement(by.tagname("div"), 0)); it enough me when test checks "yeah page contain word porn" or "nope page contain word porn" if possible glad if have access whole page code in string if possible. my first question here hope ok thank in advance! p.s.:

php - How could a cms application split content over multiple pages? -

i have idea website involves content being split on multiple pages. similar this: http://tympanus.net/development/3dbookshowcase/ however, have no idea how work out how split content, aside using monospaced font, working out how many words there per page , diving total number of words page number. however, i'd use different number of fonts, insert images , diagrams. i'm thinking dynamically finds out widths of each font character , counts each character per page , there works out how split them. that's getting bit bad though. how word processor know how split pages, , realistically replicated using php or ruby on rails or other server-side language? in terms of rendering different pages, it's not trivial task. cms, if content book-length, pre-processing this: each page stored separately, , don't have calculations determine each pages starts inside content html. however, might cause problems sentences wrap 1 page next: because of pixel differen

multithreading - What is the main thread in GCD? -

what main thread in grand central dispatch? thread created when program starts (maybe before main() function gets called), arbitrarily called "the main thread"? or program's main execution flow, created every running process? think first option right one, because it's not possible send blocks executed program's main execution flow, guess, unless done explicitly. so, main thread in gcd must thread created wait blocks executed. right? gcd has no main thread unless running in context of cf/foundation based process has 1 of own. if use dispatch_main there's no main thread.

c# - Lightswitch 2012 Update 2. Cannot edit data -

i had functioning lightswitch application built vs2012rtm. interacting ria service backend. recently, ria service assembly 'upgraded' use dbcontext instead of objectcontext, breaking lightswitch application. so, created new datasource in lightswitch source sql server, , switched of screens on new datasource. then, did 'upgrade project' in visual studio update 2. now, none of screens editable. nothing internal permissions changed, datasource , login (which has rights needs) , version of lightswitch. any clues? usually, screens can't edited caused underlying data appearing read-only lightswitch, or tables don't have key property has unique value each record in table. what happens if create basic table, bound 1 of tables in data source?

c# - ASP.NET IIS7.5 Parser Error -

i have production system , test system, both running iis. in production system, runs fine. in test system, have directed copy of folder site code contained in set virtual directory. app_code folder in root , contains .cs files. when running same site in test, server error in '/' application. -------------------------------------------------------------------------------- parser error description: error occurred during parsing of resource required service request. please review following specific parse error details , modify source file appropriately. parser error message: not load type 'sptasks.master'. source error: line 1: <%@ master language="c#" inherits="sptasks.master"%> line 2: <html> line 3: <head runat="server"> source file: /sptasks/master.master line: 1 any idea why coming in test , not in production? code not compiling reason? thanks! some of comments have asked mvc, looks we

json - Convert JSONArray to appropriately-typed Java array -

i'm struggling @ integrating existing pieces of code server accepts inputs via json payload. handed json object, , need construct map represents key-value pairs, values take on reasonable, expected types. org.json parser seems adequate every case except 1 around jsonarrays. i can see it's quite easy build string[] jsonarray ... provided know string[] need. however, handed arrays of doubles, arrays of ints, nothing distinguish them. need figure out type, , create appropriately-typed array. i've tried pulling first element array , getting type, in hopes of creating array instance of type, so: private object[] decodetoarray(jsonarray list) throws jsonexception { if (list.length() > 0) { class<? extends object> type = list.get(0).getclass(); type[] result = array.newinstance(type, list.length()); } but of course, doesn't compile -- type instance, not class; won't accept ? type; , if try give name, la <t extends obj

Convert standalone Javascript to widget -

we have 8,300-line javascript application, implements interactive diagram hand of bridge. it's written 250 top-level variables, 250 functions, 130 lines of driver code outside of functions, , 30 hard-coded element ids referenced in various places; it's entirely self-contained, no libraries used. gets parameters url query string. way use on web pages load in iframe. this implemented 3 files: handviewer.html - page point in iframes. contains 70 lines of html required divs, , loads css , js (called handviewer-old.html in test below) hvstyles.css - css page handviewer.js - javascript code described above in handviewer.html , active elements have inline onclick attributes call functions in handviewer.js . the problem when embed lots of these on page, performance suffers. iframes pain begin with, , lots of them pointing same server run connection limits. , though they're pointing @ same script, parameters in query string act cache-buster. loading page 12 of