Posts

Showing posts from May, 2012

c# - MonoMac System.Drawing.Image.GetPropertyItem(0x5100) -

recently, trying answer so question loading frames (bitmap , duration) of animated gifs . code can found on pastenbin . while doing additional tests on code before moving dev library, noticed there problem line of code: //get times stored in gif //propertytagframedelay ((propid) 0x5100) comes gdiplusimaging.h //more info on http://msdn.microsoft.com/en-us/library/windows/desktop/ms534416(v=vs.85).aspx var times = img.getpropertyitem(0x5100).value; when running on windows .net using ( example gif ), array of same size amount of frames in animated gif , filled durations of frames. in case byte[20] converts (bitconverter.toint32()) 5 durations: [75,0,0,0,125,0,0,0,125,0,0,0,125,0,0,0,250,0,0,0] on monomac however, line of code same example gif returns byte[4] converts 1 duration (the first): [75,0,0,0] i tested 10 different gif's , result same. on windows durations in byte[], while monomac lists first duration: [x,0,0,0] [75,0,0,0] [50,0,0,0] [125,0,0,0] lo

vba - Replacing Text In a Textbox in Continues Forum -

it's simple enough change textbox value of form. how change text box of continues forum on every record? the onload event not work because change first record only. ideas? example code: private sub form_load() txb_name.value = txb_name.value & "test" end sub in example, continues form this: text1test text2 text3 text4 text5 text6 notice how changed first record. what need this: text1test text2test text3test text4test text5test text6test found solution using calling own function in recordsource: =myfunction(fieldname) and then, can put whatever want in function function myfunction(fieldnameas string) myfunction= fieldname& "test" end function this loop on records instead of first one.

api - Best way to serialize Django-nonrel + MongoDb queries for exchanging with mobile devices? -

i want exchange information between django-nonrel+mongodb , mobile devices via http. when mobile device makes request api, django view executes query, , respond serialization of query results. my problem django's built-in serialization formats don't play models containing embedded aggregates , lists. work around not using these no-sql features, nullify motivation using mongodb in first place. what best way serialize data mongodb query? i know can import bson , use "encode" , "decode" functions, seem work on dictionaries. current inelegant view test code makes cumbersome embedded dictionary structure underlying model: def get_announcements(request): """ return bson representation of ten recent announcements relevant user. """ user = user.objects.get(username='*<somebody>*') # test user campaign_announcements = campaign.objects.filter(workers=user.id)[:10] data = {} campaign in campaig

html - Some doubts related to the clear property on the footer in a tabless layout -

i have implement following fixed tabless layout using html+css: http://onofri.org/example/webtemplate/ (i have finalize settings) this layout have 2 floatted columns #content , #sidebar , under these columns there placed footer div #footcontainer ok, have clear elements place under tow columns (bring elements in normal flow of document), use clear css property. i have read in differents way. in example have created empty div having id clearer2 have following css settings: #clearer2{ clear: both; } this work well, know clear directly footercontainer, in way: #footcontainer { clear: both; width: 100%; min-height: 200px; height: auto !important; height: 200px; background: #4f4f4f url(../images/bgfooter.jpg) repeat-x 0 0; box-shadow: 0 -13px 25px 5px #b2b2b2; } at logic level should same thing because set clear: both; property on item , property valid successive items. reading online seems me first solution better second one. why

php - Git pull from Bitbucket server -

i have problem running git pull php script on remote server. have looked @ lot of different sources make work none works me. have done far: created pub , private key apache: mkdir /var/www/.ssh sudo chown -r apache:nobody /var/www/.ssh su - apache -c "ssh-keygen -t rsa" then have put public key on bitbucket. then run command: sudo -u apache git pull everything works fine. after wrote simple sh script call php . the .sh script: #!/bin/sh git pull and php script: <?php $cmd="./gitpullsc.sh 2>&1"; echo exec($cmd); ?> i run php script web browser , this: permission denied (publickey). fatal: not read remote repository. please make sure have correct access rights , repository exists. then tried add script whoami (to see if user running php script right one) , apache. ok. i use red hat linux. any appreciated :) update ok, maybe found problem, still looking solution. i run again sudo -u apache g

php - AJAX Show/hide content -

Image
before complains ive tried google there isnt straight forward answer or tutorial of sort.. basically ive got articles paragraph seen *read more" link using javascript shows more content, although slow down website rest of article there hidden. so question how set ajax/php bring in content instead? know how set database on mysql , right in guessing need type out article in mysql when storing in there? sorry if im saying confusing im confused myself... if explain absolute beginner great google isn't friend after hours of searching. think ive been misunderstood. above screenshot ive achieved im wanting instead of hiding content displaying on-click have being called in using ajax, database , php add "previewcutoffindex" or similar articles table. on page load, display article html / content cutoff index. for "read more" button, put article identifier attribute add click handler makes ajax call, load rest of article markup ("da

c - undefined reference to `ceilf' -

i trying "make" program , yet face these errors; used make -lm , did #include still face same problem. tried installing application on both ubuntu , debian make sure remove doubts on corrupted libraries.still no success ! nat_src_endpoint_ip.o: in function `__new': /root/softwares/sweetspot-0.0.20/src/nat_src_endpoint_ip.c:95: undefined reference `ceilf' nat_src_endpoint_tcp.o: in function `__create': /root/softwares/sweetspot-0.0.20/src/nat_src_endpoint_tcp.c:58: undefined reference `ceilf' nat_src_endpoint_udp.o: in function `__create': /root/softwares/sweetspot-0.0.20/src/nat_src_endpoint_udp.c:59: undefined reference `ceilf' nat_src_endpoint_icmp.o: in function `__create': /root/softwares/sweetspot-0.0.20/src/nat_src_endpoint_icmp.c:48: undefined reference `ceilf' collect2: ld returned 1 exit status make[1]: *** [sweetspot] error 1 make[1]: leaving directory `/root/softwares/sweetspot-0.0.20/sr

Building Form Based On an Association in Rails -

i new rails , having bit of problem simple page putting learning , hoping might have suggestions on fix or better approach. essentially, have concept of scratch pad. each pad has_many tasks , has_many notes. in pad's show, want have 2 independent forms. 1 adding tasks , 1 adding notes. problem is, build forms so: <%= form_for([@pad, @pad.tasks.build]) |f| %> <%= f.text_field :text %> <%= f.submit %> <% end %> now, since i've called .build, when later call below code render tasks renders additional, empty record in list. <ul> <%= render @pad.tasks %> </ul> i thought using nested form, seems require me use padscontroller::update rather taskscontroller:create want to. what appropriate approach in situation? being new rails (started yesterday), i'm afraid i'm missing obvious. edit: added source github repository. said, learning project me. https://github.com/douglinley/scratchpad if want new task w

java - Running a simple JBDC program from command prompt -

need assistance on running simple jdbc program command prompt. tried different methods not able success in running it. my system environment variables i.e. user variables: path c:\program files (x86)\java\jdk1.7.0_03\bin my jbdc program present in d:\jdbc\a.java and path of oracle jar file is: d:\oracle_10g\app\oracle\product\10.2.0\server\jdbc\lib\ojdbc14.jar can 1 me out run , setting ojdbc14.jar classpath great full. to compile: d:\jdbc>javac -cp "c:\program files (x86)\java\jdk1.7.0_03\bin;d:\oracle_10g\app\oracle\product\10.2.0\server\jdbc\lib\ojdbc14.jar "a.java to run: d:\jdbc>java -cp "c:\program files (x86)\java\jdk1.7.0_03\bin;d:\oracle_10g\app\oracle\product\10.2.0\server\jdbc\lib\ojdbc14.jar;." a best of luck , if should have further problems, let me know.

Android Studio - how to add a preview for layouts I will inflate somewhere in my code? -

i have 3 layouts: fragment_tag.xml : <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> </linearlayout> fragment_stunde.xml : <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/linearlayout"> </linearlayout> fragment_fach.xml : <relativelayout android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android"> <textview android:layout_width="wrap_content

vb.net - Trouble with async webrequest -

in first page launch async webrequest on page loaded event. private sub loadrecent() dim request httpwebrequest = httpwebrequest.create("") request.method = "get" request.begingetresponse(new asynccallback(addressof responserecent), request) end sub private sub responserecent(byval asynchronousresult iasyncresult) dim webrequest httpwebrequest = directcast(asynchronousresult.asyncstate, httpwebrequest) dim webresponse httpwebresponse = webrequest.endgetresponse(asynchronousresult) dim stream new streamreader(webresponse.getresponsestream()) dim responsestring = stream.readtoend end sub using code, loadrecent() successfull launched on page loaded. let's suppose have button in first page brings me in page. if press button brought first page again , loadrecent() fired well. problem response of webrequest same of first time have been fired (and can tell not possible). it's should di

oop - Array / List / collection of objects of a class in R -

i beginner oop in r , stuck @ problem can find no solution. i defined class "node" in r using setclass contains information "node" in network - setclass(class = "node", representation = representation(nid = "integer", links = "integer", capacity = "numeric"), prototype = prototype(nid = integer(1), links = integer(20), capacity = numeric(20))) what want create array/list holds several "nodes", each of of class "node". like nodeid[100] <- new("node") but doesnt work. have tried creating arrays , converting class "node" didnt either. this me things loop on nodes in system- for(i in 1:dim(nodeid)) { nodeid[i]@capacity <- 1000 blah blah.... } note problem isnt initializing/defaulting value of slots (e.g. capacity in case). can that. appreciate. thanks, sumit answer ---- thanks @ricardo , @dickoa. created list of nodeid wan

Call a method when click on preference header Android -

i call method clear cache when click on specific header in preference screen in android. the problem onsharedpreferencechanged never called : here piece of code of preferences.xml : <header android:icon="@drawable/ic_action_cancel" android:title="vider le cache d'articles" android:key="clearcache" android:summary="clear datas."> </header> and, here code of settingactivity : package com.rss.preferences; import java.io.file; import java.util.list; import com.rss.r; import android.content.context; import android.content.sharedpreferences; import android.content.sharedpreferences.onsharedpreferencechangelistener; import android.os.bundle; import android.preference.preferenceactivity; import android.preference.preferencemanager; import android.util.log; import android.view.gravity; import android.widget.textview; public class settingsfragment extends preferenceactivity { sharedpreference

compiler errors - How use Eigen library in Dev C++? -

i downloaded library eigen.tuxfamily , decompress in folder called eigen. code in dev c++ (and in same directory of eigen folder): #include <iostream> #include <eigen/eigen/dense> using namespace eigen; using namespace std; matrixxd m(2,2); int main() { m(0,0) = 3; m(1,0) = 2.5; m(0,1) = -1; m(1,1) = m(1,0) + m(0,1); cout << m << endl; } but program displays following error: eigen/eigen/dense: no such file or directory. , more errors arising. have set in program? how fix it? , regards. it me bad idea work inside eigen's directory. quick fix replace <> " in #include <eigen/eigen/dense> to #include "eigen/eigen/dense" however should consider using gcc -i -l -l flags use external library.

Single integer as key in firebase (Firebase array behavior) -

if insert data node/a/0 in firebase. the result treat a array a[0] . the same way, if set data in node/a/1 first array become null "a" : [ null, { "-j-22j_mb59l0ws0h9xc" : { "name" : "chok wee ching" } } ] but fine if node/a/2 "a" : { "2" : { "-j-25xjexuqcpsc-5loe" : { "name" : "chok wee ching" } } } my guess, firebase automatically treat single 0 , 1 array. how can prevent this? firebase has no native support arrays. if store array, gets stored "object" integers key names. however, people storing arrays in firebase, when call .val() or use rest api read data firebase, if data looks array, firebase render array. in particular, if of keys integers, , more half of keys between 0 , maximum key in object have non-empty values, firebase render array. it's la

auctex - What is the difference of tex-mode and latex-mode and LaTeX-mode in emacs -

i configuring auctex in emacs. most of configurations put in latex-mode-hook. when open main.tex file, notice major mode latex-mode , hooked configurations not activated. have m-x tex-latex-mode activate them. major-mode still latex-mode. (add-hook 'latex-mode-hook (lambda () ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; auctex (setq tex-auto-save t) (setq tex-parse-self t) )) so know difference of these modes , how can turn on auctex automatically when open *.tex file. the modes provided auctex listed @ https://www.gnu.org/software/auctex/manual/auctex.html#modes-and-hooks , are plain-tex-mode latex-mode ams-tex-mode context-mode texinfo-mode doctex-mode instead, tex-mode plain-tex-mode latex-mode slitex-mode doctex-mode (note different capitalization) major modes provided tex mode package shipped emacs. if want open *.tex files auctex latex mode add .emacs : (add-to-list 'auto-mode-ali

oracle - Tracking failed transaction in bulk insert/update/delete -

i have following code structure procedure .. pragma exception_init(dml_errors, -24381); l_errors number; begin -- busines logic forall table_1 delete; forall table_1 update; forall table_1 insert; forall table_2 insert; forall table_2 update; forall table_2 insert; exception when dml_errors --extract error indexes end; each of forall loop deals separate table of array i.e., loop deleting table_1 deal table of table_1_u index pls_integer; each forall loop has save exceptions keyword now, how can extract "for" failed , "which record in index failed". how can extract "for" failed with call stack ( format_error_backtrace ) or implementing sort of steps: procedure .. pragma exception_init(dml_errors, -24381); l_errors number; istep number; begin -- busines logic istep := 0; forall table_1 delete; istep := 1; forall table_1 update; istep := 2; forall table

jquery - Masonry is not working until resize window -

i have seen posted couple of times on here neither had solution has worked. i using jquery masonry lay out lots of divs image , caption inside. i have set "height:auto;" css of each item in masonry. expected once window has loaded masonry take effect , lay out content should. unfortunately, loads 4 columns images overlapped in height. if set height in px css works, website responsive , need height @ auto preferably, don't want change css height through each media query... appreciate :) thanks the js code is: $(window).load(function() { var columns = 4, setcolumns = function() { columns = $( window ).width() > 700 ? 4 : $( window ).width() > 480 ? 2 : 1 }; setcolumns(); $( window ).resize( setcolumns ); $( '#container' ).masonry( { itemselector: '.item', gutterwidth: 66, isfitwidth: true, isanimated: true, columnwidth: function( containerwidth ) { return co

dynamics crm 2011 - SOAP requests to CRM2011 via PHP -

i trying create lead in microsoft dynamic 2011. have connected php script crm , positive feedback. i have used fiddler soap code used create lead in crm2011. however, when use same code through php script 'false' return. the soap code have discovered below: <s:body> <execute xmlns="http://schemas.microsoft.com/crm/2009/webservices"> <command>1</command> <commandxml> <input> <id>{00000000-0000-0000-0000-000000000000}</id> <name>lead</name> <formid>e3b6ddb7-8df0-4410-ac7b-fd32e5053d38</formid> <dataxml> <lead> <leadqualitycode>2</leadqualitycode> <statuscode>1</statuscode> <

My nginx + fastcgi configuration downloads php files instead of executing them -

i'm using configuration on fresh install of php5-fpm , nginx on ubuntu 13.04: server { listen 80 default_server; listen [::]:80 default_server ipv6only=on; root /usr/share/nginx/html; index index.php index.html index.htm; server_name localhost; location / { try_files $uri $uri/ /index.html; } location /doc/ { alias /usr/share/doc/; autoindex on; allow 127.0.0.1; allow ::1; deny all; } error_page 404 /404.html; location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; # note: should have "cgi.fix_pathinfo = 0;" in php.ini # php5-cgi alone: fastcgi_pass 127.0.0.1:9000; # php5-fpm: fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; include fastcgi_params; } } but, web browser seeing php text instead of executed results. should

php - Storing KineticJS json string in mySQL and then get it with other page to reload the canvas -

i hope understand problem is... i built little t-shirt-shop kineticjs. i store stage tojson() in json-string , save in mysql database. now when try string other page database , insert string kineticjs function var stage = kinetic.node.create(json, 'container'); it doesn't work. the curious thing when database , copy whole string directly javascript work. fact string database javascript, save in variable , try use gets me "unexpected token" error. make sure "json" variable string, not object. otherwise, make string: json.stringify(json);

Save and Restore TextView Data. -

i have activity several textview elements include buttons. when button specific set of textview elements clicked new activity started enter data. data returned specific textview elements. my problem when select button different set of textview elements, new activity appears enter data , new data returns main activity, entered data gone. how keep entered data being removed? how keep entered data being removed? <textview ... android:freezestext="true" /> from documentation on freezes text: if set, text view include current complete text inside of frozen icicle in addition meta-data such current cursor position. default disabled; can useful when contents of text view not stored in persistent place such content provider.

java - Collision detection bug -

i've tried expand little on enemy spawning system using factory design pattern. so have: enemy (abstract): enemytyp ea, b, c, d... etc., each of extend enemy. i have this: (works) public void spawnenemy(int type, int amount) { enemy theenemy = null; (int i=1; i<amount+1; i++ ) { theenemy = enemyfactory.makeenemy(type, 0-i*40, 400); aliens.add(theenemy); health.add(2); system.out.println("attack message recieved "+i); } repaint(); } but cannot seem collision detection work. public void checkcollisions() { rectangle r3 = player.getbounds(); arraylist ms = player.getmissiles(); (int = 0; < ms.size(); i++) { missile m = (missile) ms.get(i); rectangle r1 = m.getbounds(); (int j = 0; j<aliens.size(); j++) { enemy = (enemy) aliens.get(j); rectangle r2 = a.getbounds();

Image does not open with python imaging library -

i have installed python imaging library , started learn cannot sem open image file. import image im = image.open("desert.jpg") print im.format, im.size, im.mode im.show() the image attributes printed fine when image opens in windows viewer, error file "c:\python27\lib\site-packages\pythonwin\pywin\framework\scriptutils.py" ,line 325, in runscript exec codeobject in __main__.__dict__ file "c:\users\hassan\documents\imtest.py", line 2, in <module> im = image.open('desert.jpg') file "c:\python27\lib\site-packages\pil\image.py", line 1952, in open fp = __builtin__.open(fp, "rb") ioerror: [errno 2] no such file or directory: 'desert.jpg' i have placed file desert.jpg in same directory script saved.what should open file. use absolute path. can path of script create path: import os.path script_dir = os.path.dirname(os.path.abspath

list - How to add row to top of a table in java -

i using java add rows table. able add row table @ end of list using following code: list list = (list) session.getattribute("list"); detailsmod mod = new detailsmod(); list.add(mod); if change last line to: list.add(0, mod); it add first column top of table while rest of columns remain @ bottom of table. the html looks smth this: <% list resultlist = (list) session.getattribute("list"); detailsmod bean = new detailsmod(); if(resultlist.size() > 0 ) { for(int i=0; i<resultlist.size(); i++){ bean = (detailsmod) resultlist.get(i); %> <tr> <td height="17"> <input name="tbx_a<%=i%>"value="<%=bean.geta()%>" readonly/> </td> <td height="17"> <input name="tbx_b<%=i%>" value="<%=bean.getb()%>" /> </td> </tr> <% } }%> so yeah... how add entire row t

javascript - Fineuploader never completes on IE8-9 -

i'm using fineuploader upload large video files server. works on browsers except ie8 - ie9. files start upload continue upload pretty "forever" , not complete. it works on ie smaller files (limited max php post size). there way stop or give kind of error message ie8-9 users? i thinking of setting max post file size huge... unsure if has performance issues server? any appreciated. code far below: <script src="fineuploader/jquery.fineuploader-3.7.0.js"></script> <script> var filecount = 0; var addedfiles = 0; var filelimit = 1; $(document).ready(function() { //hide submit button until video has finished uploading $('#submit').hide(); $('#uploadmessage').hide(); var filelimituploader = new qq.fineuploader({ element: $('#filelimit-fine-uploader')[0], request: { endpoint: 'processfile/example.php' },

ssh tail output lines only with keyword -

i'm trying tail large file in ssh command prompt, need filter displays lines contain particular keyword in them. i'm using command tail. # tail /usr/local/apache/logs/access_log if possible please let me know add command accomplish this. you can pipe output of tail , use grep . filter displays lines contain particular keyword in them you do: tail /usr/local/apache/logs/access_log | grep "keyword" where you'd replace keyword keyword.

mysql - count null filed of left joint table -

table article id title table comment id articleid comment select a.*, count(c.id) article left joint comment c on c.articleid = a.id limit 0, 10 i want display article number comments, list 1 result (has comment). and not list articles not have comments. how list articles (have comments/ have not comment) ? first of have use group by in base query select a.id, a.title, count(c.id) comment_count article left join comment c on c.articleid = a.id group a.id, a.title sample output: | id | title | comment_count | ------------------------------- | 1 | title1 | 2 | | 2 | title2 | 0 | here sqlfiddle demo now if using left join , want articles comments need apply having clause select a.id, a.title, count(c.id) comment_count article left join comment c on c.articleid = a.id group a.id, a.title having comment_count > 0 or use inner join andy suggested because inner join filter out mismatches (meaning articles h

How to know if object value is existing in JSON on android? -

hei i'm new web service using android. want know how check if value exist in json? here sample json { "contacts": [ { "id": "c200", "name": "michael jordan", "email": "mj@gmail.com", "address": "xx-xx-xxxx,x - street, x - country", "gender" : "male", "phone": { "mobile": "+91 0000000000", "home": "00 000000", "office": "00 000000" } } ] } i want know if name michael jordan existing in json. please me know how check if object exist in json using has how if want check value? you need read content jsonobject. can add code snippet jsonarray jsonarray = yourjsonobject.getjsonarray("contacts"); //here yourjsonobject object has array in q

multithreading - GLFW 3.0 Resource Loading With OpenGL -

i have started overwhelming scene of opengl resource loading on separate thread main thread can continue render object. when stepping in, noticed glfw released updated version month easier context management. however, glfwmakecontextcurrent() have been unable make possible. in loading thread use function , after completion add again main thread receives context further use. not allowing me create , compile shaders or other opengl related creation. updated: what needs done can use glfw in situation? glfw portable, love use code includes it. not know necessary steps prepare thread keeping glfw api in mind. as this blog post states, need create 2 threads opengl context (not same context ;d ) , share information. however, instructions shown platform specific. how can make use of glfw steps in example platform independent possible? use share parameter on glfwcreatewindow() : #include <vector> #include <gl/glew.h> #include <glfw/glfw3.h> #include

grails - Image from layout not showing in some views -

i have problem layout or views, have logo in header of layout, everytime go view logo not show, looks broken image. have no idea why happenning annoying. try use resource tag this: <img src="${resource(dir:'path_to_file', file:'file_name')}">

javascript - How can I set time for insertAfter -

how can set time insertafter , more details : $(z).find(".post--"+a).insertafter(".post:last"); for example when use .slidedown(time) slide time set want know how can insertafter as suggested in comment, can try $(z).find(".post--"+a).hide().insertafter(".post:last").slidedown(500);

ninject - NinjectServiceHost in WCF service does not call Dispose() -

i've been trying dispose method on idisposable wcf service called whilst using ninject's ninjectservicehost without luck. i've downloaded ninject.extensions.wcf example code , tried idisposable timeservice's dispose() method called, not called either. the service instantiated correctly, dispose() doesn't called. is bug or myself , example code missing? i've created stripped down service , testing host reproduces issue. code below. i'm using ninject 3.0.1.10, ninject.extensions.wcf 3.0.0.5, .net 4.5 servicemodule.cs code (for setting bindings) using ninject.modules; namespace testninjectwcf { public class servicemodule : ninjectmodule { public override void load() { bind<service1>().toself(); // i've tried bind<iservice1>().to<service1>() // , tried various scopes such inparent() , inrequestscope() } } } console test program start service. using system; using nin

java - Achartengine : remove chart before and redraw new chart -

i frustased redraw chart using achartengine library, have remove view, chart make new on top chart, confused... have search method can't it.. question before : achartengine : how repaint / redraw chart how redraw chart everytime slide seekbar? this source code : @override protected void onresume() { // todo auto-generated method stub super.onresume(); if (mchartview == null) { lnchart = (linearlayout) findviewbyid(r.id.chart); mchartview = chartfactory.getlinechartview(this, mdataset, mrenderer); mchartview.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { seriesselection seriesselection = mchartview.getcurrentseriesandpoint(); double[] xy = mchartview.torealpoint(0); if (seriesselection == null) { toast.maketext(getapplicationcontext()

iOS & Stackmob - [NSNull length]: unrecognized selector sent to instance -

in ios app i'm trying update user information in database (with stackmob), keep getting "unrecognized selector sent instance." - (ibaction)save:(uibutton *)sender { nsfetchrequest *fetchrequest = [[nsfetchrequest alloc] initwithentityname:@"user"]; nspredicate *predicte = [nspredicate predicatewithformat:@"username == %@", self.username]; [fetchrequest setpredicate:predicte]; [self.managedobjectcontext executefetchrequest:fetchrequest onsuccess:^(nsarray *results) { nsmanagedobject *todoobject = [results objectatindex:0]; [todoobject setvalue:@"example@gmail.com" forkey:@"email"]; [self.managedobjectcontext saveonsuccess:^{ nslog(@"you updated todo object!"); } onfailure:^(nserror *error) { nslog(@"there error! %@", error); }]; } onfailure:^(nserror *error) { nslog(@"error fetching: %@", error); }]; } here's full error i'm getting: -[nsnul

java - Hibernate IDENTITY vs SEQUENCE -

"unlike identity, next number column value retrieved memory rather from disk – makes sequence faster identity" defined in article . mean id comes disk in case of identity, if yes disk , how . using sequence, can see in log, select query db while inserting new record.but didn't find select query in log in case of identity. how sequence becomes faster identity . could please provide valuable insight complexity. strategy used sequence: before inserting new row, ask database next sequence value, insert row returned sequence value id. strategy used identity: insert row without specifying value id. after inserting row, ask database last generated id. the number of queries same in both cases. but , hibernate uses default strategy more efficient sequence generator. in fact, when asks next sequence value, keeps th 50 (that's dafault, iirc, , it's configurable) next values in memory, , uses these 50 next values next 50 inserts. after 50 inserts, goe

c - Why to make a interrupt handler as static.is it necessary -

during reading book ( linux kernel development robert love ) page no:119 got "the interrupt handler marked static because never called directly file." e,g static irqreturn_t intr_handler(int irq, void *dev) but why so,i doubt function going call kernel , if make static how kernel going call this. according this , way function used "registering" kernel. is, there's function such installinthdlr call , pass pointer handler. kernel can use pointer call function itself. my guess, though i'm not sure this, static used way of enforcing proper usage of interrupt handler. is, since static functions can't called other files, forces pass pointer instead of calling directly.

sql - How do I create tables for the following schema ? -

i'm beginner , having trouble respect relations. here have 2 tables 1:infinity relation . i'd appreciate if helps me understand how create tables them. a has id, name attribute b has id , email password attribute a:b = 1:infinity. how create this? also if has infinity relation on , how work out ? are looking this? create table users ( id int not null primary key, name varchar(64), user_id int, constraint fk_users_user_id foreign key (user_id) references users (id) ); create table accounts ( id int not null primary key, user_id int not null, email varchar(64), password varchar(32), constraint fk_accounts_user_id foreign key (user_id) references users (id) ); here sqlfiddle demo

user controls - How can I add InputScope property to PasswordBox in WinRT? -

how can add input scope property user control's passwordbox? could explain me, please? thanks. according information have passwordbox not have input scope property in winrt can't set directly. if want have make separate custom control. defining own custom control have read on windows development center ..or google it..hope helps you.. can use this link..

php - How to get admin path in joomla 2.5? -

i used juri::base() admin path & returns, http://localhost/production/index.php but, want admin path of site, e.g. http://localhost/production/administrator/index.php how can admin path ? try below. read more echo juri::root().'administrator'; you can find more info here .

cordova - XMLHttpRequest and Phonegap... Same Origin Policy or not? -

i'm still new phonegap , working android sdk days now. @ least wanted xmlhttprequest data server. knew same origin policy before , asked myself, how should work "native app". i searched internet , found topics, people telling others, there no same origin policy on phonegap, because uses file:// protocol , additionally there domain whitelist in it's config.xml . on other hand there bunch of topics of people having problems xhr's , others told them, because of same origin policy... well, confused, used - on regular websites - working xmlhttprequest snippet , put phonegap app. tried virtual device, request not working. now asked myself questions: who right? there same origin policy on phonegap or not? if yes: what function has domain whitelist? what's best way still data of server? yes, people correct same origin policy needed in webapps not hybrid phonegap apps. you need check domain whitelist, check in config.xml in res -

c++ - synchronization between threads using tbb -

i using tbb programming in c++. not supposed use message queue, fifo, pipes etc platform specific. supposed use tbb specific api's. thread1: // pseuodo code exits below // take mutex m_bisnewsubsarrived = true; startsubscriptiontimer(); m_bisfristsubsarrived = true; // spawn thread here. if(m_tbbtimerthread == null) { m_bistimermutextaken = true; m_timermutex.lock(); m_tbbtimerthread = new tbb::tbb_thread(&waitfortimermutex, this); if (m_tbbtimerthread->native_handle() == 0) { // report error , return. return; } } // thread 1 exited. in thead releasing mutex taken above. thread 2. m_timermutex.unlock(); m_bistimermutextaken = false; thread 3: // waiting mutex m_timermutex.lock(); in above code problem think thread 1 locked m_timermutex not relased think thread2 not able unlock. , thread 3 blocked ever. i think can use

javascript - how to use jquery file upload angular version? -

here how use angular jquery file upload var album = angular.module('album', ['restangular', 'blueimp.fileupload']), .controller('somecontroller',function($scope,){ $scope.options = { } }) all did set scope.options, change controller ,and magically works setup jquery file upload seems quite easy, there confuse me how can call jquery file upload's callback function. example, if files uploaded successfully,i want update ui calling fileuploaddone function ,it confuse me because there no added file in controller. i'm new angularjs, please me understand workflow of angular jquery file upload the blueimp.fileupload uses events fired via $emit notify parent scopes: on([ 'fileuploadadd', 'fileuploadsubmit', 'fileuploadsend', 'fileuploaddone', 'fileuploadfail', '

linux - Command to find the time difference -

i have log, dumped 1 or more process simultaneously. sometimes, because of cpu on load , context switching, logging file delayed. want find time difference between each line , print before each line? log example: 07/18 16:20:29886564 pid= 2998,tid= 3036, xxxxx.c: 335:xxxxx:### xxxxxxxxxxxxxxxxxx ### 07/18 16:20:29886642 pid= 2998,tid= 3036, xxxxx.c: 484:xxxxx:### yyyyyyyyyyyyyyy() 07/18 16:20:29886880 pid= 2998,tid= 3036, xxxxx.c: 488:xxxxx:>>>yyyyyyyyyyyyy() 07/18 16:20:29887002 pid= 2998,tid= 3036, xxxxx.c: 494:xxxxx:>>>ok: zzzzzzzzzzzzzzz() i suppose possible 'awk'. but, pretty bad @ linux commands. please this? you can try following awk command. have commented can understand how works: awk '{ # split time field split($2,arr,":"); # convert hours , mins seconds , compute total curr=arr[3]+arr[2]*60+arr[1]*60*60; # set previous value first line if(prev == 0) prev=curr; # print out difference b

hadoop - AWS Toolkit for Eclipse : Running AwsConsoleApp issue? -

i'm new aws, when try run awsconsoleapp.java in eclipse, i'm getting following error. have set access-id , secret-key properly. =========================================== welcome aws java sdk! =========================================== caught exception: request has expired. timestamp date 2013-07-09t06:24:57.628z reponse status code: 400 error code: requestexpired request id: xxxxxx-xxx-xxxxxx-xxxxxxx caught exception: request has expired. timestamp date 2013-07-09t06:25:00.216z. current date 2013-07-22t07:27:27z reponse status code: 400 error code: requestexpired request id: xxxxx--xxxx-xxxx-xxxx-xxxxxxxxx error message: difference between request time , current time large. http status code: 403 aws error code: requesttimetooskewed error type: client request id: xxxxxxxxxxx thanks in advance , can tell me change made run properly... please check time stamp in local machine. matches

Qt skips lines when rendering in small zoom levels -

i have noticed following problem when implementing word-like application: the qrasterizer in qt skips lines when have thickness smaller 1.0f. running situation when zooming out in word editor application. y values of 2 line points small this: y1 = 290.32812500000000 y2 = 290.92187500000000 when rendering line qt skips it. have tracked down following code in qrasterizer::rasterize(), min_y , max_y 2 above y values times 64 (fixed point values): int itopbound = qmax(d->cliprect.top(), int((min_y + 32 + coord_offset - coord_rounding) >> 6)); int ibottombound = qmin(d->cliprect.bottom(), int((max_y - 32 + coord_offset - coord_rounding) >> 6)); if (itopbound > ibottombound) return; since min_y rounded upwards , max_y rounded downwards runs if condition , returns without performing rendering. i can workaround problem enabling anti-aliasing, results in rendering getting brighter when zooming out. need behavior in microsoft word: no matter how far

scala - How to handle exception with ask pattern and supervision -

how should handle exception thrown dbactor here ? i'm not sure how handle it, should pipe failure case ? class restactor extends actor actorlogging { import context.dispatcher val dbactor = context.actorof(props[dbactor]) implicit val timeout = timeout(10 seconds) override val supervisorstrategy: supervisorstrategy = { oneforonestrategy(maxnrofretries = 10, withintimerange = 10 seconds) { case x: exception => ??? } } def receive = { case getrequest(reqctx, id) => { // perform db ask ask(dbactor, readcommand(reqctx, id)).mapto[someobject] oncomplete { case success(obj) => { // stuff } case failure(err) => err match { case x: exception => ??? } } } } } would glad thought, in advance ! there couple of questions can see here based on ??? in code sample: 1) types of things can when override default supervisor behavior in definition of how handle exceptio

jquery - Float bottom - top of each other -

hi every 1 want ask css - jquery drag , drop -issue. i'm familiar positioning divs bottom of containers (position: relative -> position: absolute; bottom: 0;). goal: want drag items storage div , drop div , position items bottom top, vertically. building tower (2d) or something. how can float items bottom of new container , top of each others? thanks - jani #drop { height:300px; background:#edcce9; } #drag { margin-top:10px; height:50px; background:#b8d8e3; } #drag img { display: inline-block; margin-right:10px; } .temp { display: block; } $('.item').draggable({ containment: 'document', revert: true, helper: 'clone', start: function () { contents = $(this).html(); currentvalue = $(this).attr('value'); } }); $('#drop').droppable({ hoverclass: 'border', accept: '.item', drop: function (event, ui) { $(this).append($(ui.draggab

function - parameter use in R -

scorekm <- function(km, x1,x2,x3,x4) { data<-matrix(c(x1,x2,x3,x4),nrow=1) k <- nrow(km$centers) n <- nrow(data) d <- as.matrix(dist(rbind(km$centers, data)))[-(1:k),1:k] d <- matrix(d,nrow=1) out <- apply(d, 1, which.min) return(out) } this original function. there several parameters (not 4, maybe 8, 12,...), , every 4 unit. should use loop? in loop, how can reach parameter?and how know how many there are? scorekm <- function(km,x...){} function should this. km<-kmeans(iris,3) scorekm<- function(km, x,...) { result=null for(i in 1:nargs()-1) { data<-matrix(c(args[[i+1]],args[[i+2]],args[[i+3]],args[[i+4]]),nrow=1) k <- nrow(km$centers) d <- as.matrix(dist(rbind(km$centers, data)))[-(1:k),1:k] d <- matrix(d,nrow=1) out <- apply(d, 1, which.min) result<-cbind(out,result) i<-i+4 } return(result)} i collect variables through ... so: scorekm <- function(km, x, ...) { x.args <- l

Editing Word Document, add Headers/footers and save it - Python -

i want add headers , footers every page of word document, , want add pages start of document, how can using python ? have tried python-docx not working expected. there other way achieve requirement ? i think best way can take looking @ python-docx see how manages files. docx zipped format ( docx tag wiki ): the .docx format zipped file contains following folders: +--docprops | + app.xml | \ core.xml + res.log +--word //this folder contains of files control content of document | + document.xml //is actual content of document | + endnotes.xml | + fonttable.xml | + footer1.xml //containst elements in footer of document | + footnotes.xml | +--media //this folder contains images embedded in word | | \ image1.jpeg | + settings.xml | + styles.xml | + styleswitheffects.xml | +--theme | | \ theme1.xml | + websettings.xml | \--_rels | \ document.xml.rels //this document tells word images situated + [content_types].xml \--_rels \ .rels

Split string to desired form using Python -

i have data in following form: <a> <b> _:h1 <c>. _:h1 <e> "200"^^<http://www.w3.org/2001/xmlschema#integer> <f> . _:h1 <date> "mon, 30 apr 2012 07:01:51 gmt" <p> . _:h1 <server> "apache/2" <df> . _:h1 <last-modified> "sun, 25 mar 2012 14:15:37 gmt" <hf> . i need convert following form using python: <a> <b> _:h1. <1> <c>. _:h1 <e> "200"^^<http://www.w3.org/2001/xmlschema#integer> . <1> <f>. _:h1 <date> "mon, 30 apr 2012 07:01:51 gmt". <1> <p>. _:h1 <server> "apache/2" . <1> <df>. _:h1 <last-modified> "sun, 25 mar 2012 14:15:37 gmt" . <1> <hf>. i wrote code in python using str.split() method. splits string based on space. however, not solve purpose using "sun, 25 mar 2012 14:15:37 gmt" gets split. there other way ac