Posts

Showing posts from April, 2015

iphone - How to get video frame from AVCaptureOutput face detect metadata objects -

i able face detection video stream working following stachecam example wwdc 2012 . however, cannot corresponding image frame. have both captureoutput:didoutputsamplebuffer:fromconnection: and captureoutput:didoutputmetadataobjects:fromconnection: firing , giving me data both asynchronous calls , don't see way accurately sync facebox frame.

.net - Serialization issue when using StateServer mode in asp.net -

if session mode set "stateserver", serialization error because i'm storing list of controls in session, , adding aspx placeholder control. here's code think problematic: protected sub addctrl(byval ctrl control) dim l list(of control) if session("ctrls") nothing l = new list(of control) else l = directcast(session("ctrls", list(of control)) end if end sub later on in code, iterate through ctrls session object, , add each control placeholder in html. what can fix problem? tried create custom list inherits list, , made serializable , use custom list instead, didn't it: <serializable()> _ public class mylist inherits list(of control) i tried using viewstate instead , didn't it. seeking advice... thanks!

python 2.7 - Finding a substring within a string without using any built in functions -

i have find particular substring within string , position within string. easy have without using built in functions or methods in python. appreciate if help. thanks string="acaagatgccattgtcccccggcctcctgctgctgctgctctccggggccacggccaccgctgccctgcccctggagggtggccccaccggccgagacagcgagcatatgcaggaagcggcaggaataaggaaaagcagcctcctgactttcctcgcttggtggtttgagtggacctcccaggccagtgccgggcccctcataggagaggaagctcgggaggtggccaggcggcaggaaggcgcacccccccagcaatccgcgcgccgggacagaatgccctgcaggaacttcttctggaagaccttctcctcctgcaaataaaacctcacccatgaatgctcacgcaagtttaattacagacctgaa" substring='ttg' this code work if don't want use inbuilt function. man = "acaagatgccattgtcccccggcctcctgctgctgctgctctccggggccacggccaccgctgccctgcccc$ check = "ttg" in range (0, len(man)): if man[i]==check[0]: sum =0 j in range(0, len(check)): if man[i+j] != check[j]: break sum = 0

Android and PHP connection to MySQL Database -

i have following code , struggling working . there 2 errors in java file , can not find fix. here mysqldata.java file package com.example.qosmetre2; import java.io.bufferedreader; import java.io.inputstream; import java.io.inputstreamreader; import java.util.arraylist; import org.apache.http.httpentity; import org.apache.http.httpresponse; import org.apache.http.namevaluepair; import org.apache.http.client.httpclient; import org.apache.http.client.entity.urlencodedformentity; import org.apache.http.client.methods.httppost; import org.apache.http.impl.client.defaulthttpclient; import org.json.jsonarray; import org.json.jsonexception; import org.json.jsonobject; import android.app.activity; import android.net.parseexception; import android.os.bundle; import android.util.log; import android.widget.toast; import java.util.arraylist; import java.util.hashmap; import java.util.list; import org.apache.http.namevaluepair; import org.json.jsonarray; import org.json.jsonexception

c - use printf to print character string in hex format, distorted results -

i want print character string in hex format, on machine , like ori_mesg = gen_rdm_bytestream (1400,seed) sendto(machine b, ori_mesg, len(mesg)) on machine b recvfrom(machine a, mesg) mesg_check = gen_rdm_bytestream (1400, seed) for(i=0;i<20;i++){ printf("%02x ", *(mesg+i)& 0xff); } printf("\n"); for(i=0;i<20;i++){ printf("%02x ", *(mesg_check+i)); } printf("\n"); seed varies among 1, 2 3.... the bytes generation funcion is: u_char *gen_rdm_bytestream (size_t num_bytes, unsigned int seed) { u_char *stream = malloc (num_bytes+4); size_t i; u_int16_t seq = seed; seq = htons(seq); u_int16_t tail = num_bytes; tail = htons(tail); memcpy(stream, &seq, sizeof(seq)); srand(seed); (i = 3; < num_bytes+2; i++){ stream[i] = rand (); } memcpy(strea

Deployed azure virtual application webrole not compiled -

i have spent last couple of days getting application deployed auze. looking have gotten stuck on issue virtual applications. within servicedefinition file have <sites> <site name="web" physicaldirectory="d:\@code\web"> <virtualapplication name="api" physicaldirectory="d:\@code\api"></virtualapplication> <bindings> <binding name="endpoint1" endpointname="endpoint1" /> <binding name="endpoint2" endpointname="https" /> </bindings> </site> </sites> both applications deployed , virtual appliction created can't api application run. rdp onto server , took around. api project isn't being compiled, of .cs files in root of siteroot > 1 is there step need fix this? any assistance awesome. only webrole project ( ..site name='web'... ) "compiled". all rest of sites define, includ

jQuery $.extend() not extending the object -

working on simple calendar script, trying make possible events posted proper day; jquery $.extend not extending options object. here snippet html file: $("#cal").calendar({ month: 2, events: [{ date: "2013-4-10", workorder: 1234567890, district: 01, range: "2:00pm - 4:00pm", appnotes: "this sample of notes... end", installer: "john doe", citynotes: "this sample of notes... end" }, { date: "2013-4-1", workorder: 1234567890, district: 01, range: "3:00pm - 5:00pm", appnotes: "this sample of notes... end", installer: "john doe", citynotes: "this sample of notes... end" }] }); and beginning of plug in: (function($){ $.fn.calendar = function(options){ var defaults= { month: null, prev: "prevmonth",

sql - MS Access information before a date -

im trying find employees hired before 1991. when run query "data type mismatch in criteria expression" mean? this query: select emp_num, emp_lname, emp_fname, emp_initial, job_code, emp_pct, proj_num employee emp_hiredate < '01/01/1991'; ive tried 01-01-1991 , january 1, 1991 , tuesday, january 1, 1991. the format of hire date in table day of week, month, day#, year, ie) tuesday, november 8, 1994. 10 tips working dates in microsoft access 6 correct character use when including literal date value pound character (#). your query should be select emp_num, emp_lname, emp_fname, emp_initial, job_code, emp_pct, proj_num employee emp_hiredate < #01/01/1991#

android - startactivity from onpostexecute() of Asynctask pushes screen even when the application is not in foreground -

i'm trying launch activity onpostexecute of asynctask. if application goes background while asynctask being executed, activity getting pushed phone's launcher screen. due default behaviour of asynctask. there way of avoiding behaviour? when activity going become no longer visible user (home button pressed, etc) onpause() method called. @override public void onpause() { super.onpause(); if (myasynctask != null) { myasynctask.cancel(true); // allow task interrupted if in progress } } this assuming have reference asynctask in activity. if post code i'd better able provide solution.

Ajax rss feed not working on localhost -

i'm trying following code w3schools work oh localhost through iis. when run it, can see trying retrieve requested rss feed unfortunately never executes. allows me see options chose never displays them. many in advance help. <html> <head> <script> function showrss(str) { if (str.length==0) { document.getelementbyid("rssoutput").innerhtml=""; return; } if (window.xmlhttprequest) {// code ie7+, firefox, chrome, opera, safari xmlhttp=new xmlhttprequest(); } else {// code ie6, ie5 xmlhttp=new activexobject("microsoft.xmlhttp"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readystate==4 && xmlhttp.status==

Drupal 7 admin new menu -

Image
is possible implement new admin menu in drupal 7? currently using 7 theme. what want adding tab on content menu just: comment, comment content, comment, submission. i added new menu on admin menu structure, menu not showing anywhere. i made page--admin--content--submission.tpl.php start making interface, can't make according current selected admin theme. please point me somewhere since googled no luck. update screenshot : did try clearing cache? can via performance page, @ yoursite.com/admin/config/development/performance.

jquery - SyntaxError: unexpected POST_IF error Rails -

i'm running jquery in app/assets/javascripts/ticket.js.coffee specific view. every time visit page browser renders error - there no mention of error anywhere online. (localhost:3000/tickets/new) : syntaxerror: unexpected post_if extracted source (around line #6): 3: <head> 4: <title>ops2</title> 5: <%= stylesheet_link_tag "application", :media => "all" %> 6: <%= javascript_include_tag "application" %> 7: <%= csrf_meta_tags %> 8: </head> 9: <body> file of page throwing error - app/views/tickets/_form.html.erb : <%= form_for(@ticket) |f| %> <% if @ticket.errors.any? %> <div id="error_explanation"> <h2><%= pluralize(@ticket.errors.count, "error") %> prohibited ticket being saved:</h2> <ul> <% @ticket.errors.full_messages.each |msg| %> <li><%= msg %></li> <% end %> </ul> </div>

Implementing a Class in a new Script in R -

i've been looking around @ multiple sources trying find out how implement classes in r haven't found answer i'm looking for. learned code in java understanding of object oriented program through use of compiled language, in create class definition in .java document , import class in .java document in same package, can create objects , call class methods. there similar protocol r? i'm trying figure out how can create class object , utilize methods in different .r document 1 defined class in. basically, building script import file r , lot of data manipulation desired data frame. have created class handles data manipulations. code in importclass.r file: # class definition data importing dataimport <- setrefclass("dataimport", fields = c("startdate"), = sys.getenv("dataimportclassenv") # see setenvironment.r file value of dataimportclassenv # ----------------------------------------------------------------------------- # example met

.net - NHibernate connection.isolation settings is not used while establishing a connection to the database -

i have created .net application, using nhibernate 2.1.0.4000 connect sql server , configuration given below. <nhibernate xmlns="urn:nhibernate-configuration-2.2"> <session-factory> <property name="connection.provider">nhibernate.connection.driverconnectionprovider</property> <property name="connection.driver_class">nhibernate.driver.sqlclientdriver</property> <property name="connection.connection_string">server=(local);database=mydb;integrated security=sspi;</property> <property name="dialect">nhibernate.dialect.mssql2008dialect</property> <property name="show_sql">false</property> <property name="proxyfactory.factory_class">nhibernate.bytecode.castle.proxyfactoryfactory, nhibernate.bytecode.castle</property> <!-- specifying default schema improves query execution plan generated s

string - i want to print addition of two numbers. example " Vishal has 20+30 rupees." -

i have statement has 2 integer numbers , want print addition of 2 numbers. example " vishal has 20 + 30 rupees." in advance console.write(string.format("visual has {0} + {1} rupees", 20, 30));

jquery - 2 Javascript files conflicting in JQM page -

i trying find way stop conflicts between 2 js files on jqm page. wanting know there way make js file load 1 data-role=page? call page its' id , example. $('[data-role=page]#pageid').on('pagebeforeshow', function () { alert('page id ' + $(this)[0].id + ' here!' });

sql server - Synchronization is finished but last_sync_status is still 1 -

don't ask me weird set up, given me. i have replication set on server lot of different stuff. after replication has finised relies on trigger set on mssubscription_gents table. trigger updates table when last_sync_status set 2, value should have when replication finished. this set in production , trying set qa environment same setup reason doesn't work. table updated new value last_sync_time last_sync_status stuck @ 1 , trigger doesn't fire. any suggestion problem? i found problem in case. the database publishing backup of older database had som data in replication tables. removing publication, replication tables in target database , setting publication again resolved issue.

javascript - Call event when checkbox value is modified but not clicked -

i have dropdown list containing width values: val1 val2 val3 all and have 3 checkboxes: val1 val2 val3 the checkboxes responsible progress bar, of them have onclick function , working well. want make them work when use dropdown list can't. when select value dropdown list modifies checkboxes checked attribute has no effect on progress bar , don't know why. if using jquery (as are, according tags), set event handler change event. must trigger change event manually, since change value programatically. some information manual triggering of change event see question

jquery - JqGrid Load Json data from controller -

i using jqgrid , want display grid jquery call controller return me json data grid did not show data code here public jsonresult getplainobjectasjson() { var rows = (getdatalist() .select(c => new { id = c.catid, cell = new [] { c.catid.tostring(), c.catname, c.desc, c.desc1, c.desc10, c.desc11, c.desc12, c.desc13, c.desc14, c.desc15, c.desc16,

.net - How to use .dll class files in visual studio? -

i have download folder of .dll files codeplex.com add , use class in project don't know how use them.it zip files c# , here link: http://dotnetzip.codeplex.com/ thanks! add reference dll , try sample code: using (zipfile zip = new zipfile()) { // add map file "images" directory in zip archive zip.addfile("c:\\images\\personal\\7440-n49th.png", "images"); // add report different directory in archive zip.addfile("c:\\reports\\2008-regional-sales-report.pdf", "files"); zip.addfile("readme.txt"); zip.save("myzipfile.zip"); }

Uncaught TypeError: object is not a function when changing jQuery loading method -

this related here: running jquery inside $(window).load() function not inside $(document).ready function before using: jquery( document ).ready( function( $ ) { to load jquery ui position code decided try load using: jquery(window).load(function($) { now error: uncaught typeerror: object not function this code before change: <script type='text/javascript'> jquery( document ).ready( function( $ ) { var element_selector='.test'; if ( $(element_selector).length !== 0) { var divname515e62e8355b0 = '#test_selector'; $(divname515e62e8355b0).children().wrapall('<div class="mydoc cf">'); //jquery ui position code here } }); </script> this code after change: <script type='text/javascript'> jquery(window).load(function($) { var element_selector='.test'; if ( $(element_selector).length !== 0) { var divname515e62e8355b0 = '#test_selector'; $(divname515e62e8355b0).children().wrapa

javascript - to use changed value in setTimeout() function -

//to make ajax call server get list data function makeajaxcall() { loginsuccess =0; //to make ajax call server supported banks details var xmlhttp; // code ie7+, firefox, chrome, opera, safari xmlhttp=new xmlhttprequest(); xmlhttp.onreadystatechange=function() { alert('here'+xmlhttp.readystate+'stat='+xmlhttp.status) if( xmlhttp.readystate==4 && xmlhttp.status==200 ) { alert(xmlhttp.responsetext) if(xmlhttp.responsetext != '' ) { loginsuccess =1; renderresponse(xmlhttp.responsetext); } //else { } } //else if( ) } var params = "flaglogin="+flaglogin+"&listname="+selectedlist+formdata+loginpara; //var url = serverurl;

html email - @media queries being ignored for iphone -

for reason, media query not applying when send email. i'm sending outlook 2007 gmail , viewing using iphone 4s. i've tried sending test emails simpler @media query rules (i.e. media query changes font color) don't work either. also, i've tried sending demo html emails tutorials (such one: http://www.netmagazine.com/tutorials/build-responsive-emails ) media queries being ignored there i've attached beginning of code below: <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org /tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <meta name="viewport" content="width=device-width, initial-scale=1.0"/> <title>sample</title> <style type="text/css"> @media screen , (max-width: 480px) { tabl

Grails : Difference between \${} and ${} -

can tell me difference between : <g:if test="${foo.bar}"> and <g:if test="\${foo.bar}"> a real exemple of use of "\" before "$" : <g:if test="\${flash.message}"> thank you. \${...} put literal dollar-brace output rather evaluating contents expression. have need use in normal gsp it's common in scaffolding templates template engine uses same ${} syntax own generation-time expressions generated gsp uses @ runtime - need \${} in scaffolding template generate expressions in gsp evaluated real @ runtime when page rendered.

mysql - Adding Payment and Withdrawing system in my website using PHP -

i writing website using php-mysql system. website have payment , withdraw system. for payment, add paypal (mastercard/visa) payment system. it's good. but, question is, if pays website using mastercard or visa, payment added? paypal account? and want add moneybookers, alertpay , paypal withdrawal method. but, don't know how add them website withdraw system. have searched lot google found nothing similar. can anchor me full tutorial teaching how so. odesk , similar website's using payment , withdraw system. want add same them. as mentioned paypal handle payment processing, , funds go paypal account. there can leave t hem in paypal account, or withdraw them bank. can set account automatically withdraw funds paypal account each day , send them bank account. if wanting them sent multiple accounts, need manually. if trying withdraw funds other paypal accounts, use masspayment api or adaptive payments pay api send funds other accounts.

c - Shellcode: perform 2 execve() calls -

i trying write shellcode in assembly. need perform /usr/bin/killall command , /usr/bin/wget command. have both commands running in shellcode execve() syscall. want combine these 2, not possible because program exits when first execve() call executed. (from man pages of execve() : execve() not return on success). how can perform 2 execve() calls? or there way call both /usr/bin/killall , /usr/bin/wget same shell code? greets , in advance! when use exec-family of functions, program call substituted current process. when first execve-call made, entire process image disappears, , second call never made. around must fork process before calling execve.

logging - how to make a generic path for a log file in Ruby -

here creating logs folder under current path of directory using dir::pwd. want change pick directory path config files run in other machines. date_directory= "#{dir::pwd}/logs/#{datehelper.getdirectoryyearstamp}/#{datehelper.getdirectorymonthstamp}/#{datehelper.getdirectorydatestamp}/" fileutils.mkdir_p(date_directory) unless dir.exists?(date_directory) i tired giving absolute path , works. how make directory passing relative path? you allready using relative path, is generic solution, subfolder of current folder relative position. code published working ? inside question mention config files, want ? kind of file ? yaml, ini or of simple text file ? if simple textfile can with path = file.read("#{file.dirname(__file__)}/path.txt") edit: based on comment, following snippets wil create logfile day in /some/x/y/z folder. require 'logger' $log = logger.new("/some/x/y/z/logs.txt", 'daily' ) $log.info "test

Parse C# string to hh:mm:ss -

given 2 strings string date = "02mar13"; string duration = "03.20min"; how parse them datetime , show them in following format string date = "02 march 2013"; string duration = "00:03:20"; i went through list here no 1 match requirements. you need parse these using custom date , time format string , , output using 1 well: datetime dt = datetime.parseexact(date + duration, "ddmmmyymm.ss'min'", cultureinfo.invariantculture); string newdate = dt.tostring("dd mmmm yyyy"); string newduration = dt.tostring("hh:mm:ss"); things note: using 'min' represent min literal in string - part of custom format strings, allowing inner string literals.

ios5 - iPhone 4s and iPhone 5 compatibility -

i new iphone development want make code compatible iphone 4s , iphone5 when apply image background view of 4s size 320*480 changes in iphone 5. how manage compatibility? need manage compatibility buttons , position in iphone 4s , iphone 5. if yes? how handle position of button pro-grammatically... i found solution .. if(ui_user_interface_idiom() == uiuserinterfaceidiomphone){ cgsize result = [[uiscreen mainscreen] bounds].size; if(result.height == 480) { // iphone classic } if(result.height == 568) { // iphone 5 }} does works? yes, doing in correct way. now, need is, need check condition , based on that, have set frame of components on screen. if([uiscreen mainscreen].bounds.size.height == 568) { // iphone 5 // set frame of buttons iphone5 screen } else { // iphone 4 // set frame of buttons iphone4 & 4s screen } }

javascript - Detect if user closes popup when using gapi.auth.authorize -

using gapi.auth.authorize function, user can close popup without clicking option (no accept or deny button). when case happens, callback function doesn't fire, can't handle case. what's way resolve scenario? thanks. they don't appear mention in documentation, gapi.auth.authorize() returns popup window . can save returned window , set interval or timeout check window.closed .

php require_once -

i have in first page "login.php" <?php session_start(); $msg=''; if ((isset($_post))&& (!empty($_post))) { require_once('log.php') or die(mysql_error()); $p=md5($pass); if (login($login,$p)) { header('location:index.php');; } else { $msg="login ou mot de passe incorrect"; } } ?> log.php: $req="select * admin login='$e' , password='$p'"; $res=mysql_query($req) or die(mysql_error()."\n".$req); if(mysql_num_rows($res)!=0) { $data=mysql_fetch_assoc($res); $_session['adm']=array('code'=>$data['code'], 'login'=>$data['login']); return true; mysql_close(); } else return false; }?> and if test first page "login.php" got this: warning: require_once(1): failed open stream: no such file or directory in c:\xampp\htdocs\admin\login.php on line 6 fatal error: require_once(): failed opening requi

c# - Windows Forms SingletoneFormProvider and using second constructor to get some parameters -

i have mdi forms application , use singletoneformprovider because it's required have 1 instance of form in time. i have edit forms can used creating new records or changing existing ones. problem editing of existing record. what i've done far : i have method calls static method singletoneproviderform class , fresh instance of form : protected void loadform<t>(toolstripitem formbutton, string buttontext, long? loadentityid = null, bool closealreadyopened = true) t : baseform { //some code.. openform = singletonformprovider.getinstance<t>(parentfrm, closealreadyopened); openform.loadentityid = loadentityid; openform.mdiparent = parentfrm; openform.dock = dockstyle.fill; openform.show(); openform.activate(); //more code.. } i have 3 delcarations of singletonformprovider.getinstance<t> : static public t getinstance(form owner) t : form static public t ge

java - Reporting bug to mantis through Squash TM -

i configured bug tracker (mantis) in administration section. now, want add bug bugtracker through squashtm. got error this: http://img854.imageshack.us/img854/2739/20130313092653.png what should do? when trying on different bug tracker (mantis on localhost, not on company server) got same error. suppose reason in mantis core/e_mail_api.php file don't know sould change in file. ideas? support.

kernlab - Invalid probability model for large support vector machines using ksvm in R -

i train support vector machines using ksvm function kernlab package in r, on large numbers of observations (300k) not many features (1-8). want use resulting probability model, large data sets, resulting probability model has unexpected format. this should happen: n <- 1000 df <- data.frame(label=c(rep("x",n),rep("y",n)),value=c(runif(n),runif(n)+2)) m <- ksvm(label~value,df,prob.model=true) > prob.model(m) [[1]] [[1]]$a [1] -6.836228 [[1]]$b [1] 0.003163229 however, large values of n (e.g. 100k; beware of high memory usage , long execution times), value of prob.model(m)[[1]] numeric vector of length 2n , seemingly likelihood each observation in df . cause this? session info: r version 2.15.2 (2012-10-26) platform: x86_64-unknown-linux-gnu (64-bit) locale: [1] lc_ctype=en_us.utf-8 lc_numeric=c lc_time=en_us.utf-8 lc_collate=en_us.utf-8 lc_monetary=en_us.utf-8 lc_messages=en_us.utf-8 lc_paper=c

linux device driver - How to block packets received by eth0 from going up to TCP/IP stack -

we using dev_add_pack eth_p_all copies of sk_buff of ethernet frames received eth1. there way can prevent eth1 forwarding ethernet frames tcp/ip layer while still letting capture frames , passing on our loadable kernel module? your best bet create netfilter hook. rather dev_add_pack, gets copy of sk_buff (thereby allowing original sk_buff propagate tcp/ip stack, netfilter hook give pointer original sk_buff traverses stack, , code executes callback stack - can choose block packet, claim ownership in module, or pretty on mind.

Google Analytics PHP API (GAPI) non-mobile browsers -

i trying display top 5 of non-mobile browsers gapi. can't seem find way of doing this, possible? how percentage of mobile visits: $ga->requestreportdata(ga_profile_id, array("ismobile"), array("visits"), '-visits', null, $startdate, $enddate); foreach ($ga->getresults() $result) { if ((string)$result == "yes") $mobile["yes"] = $result->getvisits(); else $mobile["no"] = $result->getvisits(); } this how ended doing it: public function getdevices($max = 5) { $this->ga->requestreportdata($this->profileid, array('mobiledeviceinfo'), array('visits'), '-visits', 'mobiledeviceinfo != (not set) && mobiledeviceinfo != (not provided)', $this->startdate, $this->enddate, 1, $max); foreach ($this->ga->getresults() $result) { $device[] = (string)$result; $visits[] = $result->getvisits(); } if (!isset($devi

mysql - Can not connect to local database with c# System.Data.SqlClient -

i have problems connecting local db using c# system.data.sqlclient. information: db parameters: name: baza host: localhost instance: baza port: 3306 schema: world my connection string: @"server=localhost\baza;password=pass;user id=root;database=world;persist security info=true" using: c#, system.data.sqlclient, mysql workbench firewall off succesfull conection jdbc, server working jdbc parameters: string url = "jdbc:mysql://localhost:3306/"; string driver = "com.mysql.jdbc.driver"; string dbname = "world"; string username = "root"; string pass = "pass"; problem: when use conn.open(); happen => (provider: sql network interfaces, error: 26 - error locating server/instance specified) tried: server=localhost gives => error: 40 - not open connection sql server many other stupid combinations server=baza http://blogs.msdn.com/b/sql_protocols/archive/2007/05/13/sql-network-interfaces-error-26-

android - C++ network Library in For IOS -

this question being asked many times on stackoverflow in hope of getting updated answer , news here comes again... have created application gui in objective c , want implement networking part in c++ can use android too. so there c++ networking library out there can use purpose or have in objective c ios , in java android.... poco maybe choice. its networking module have tcp, udp, http , https support, both in android , ios.

objective c - beginSheetModalForWindow - the alert window disappear -

what's wrong piece of code implemented in appdelegate ? alert appears shortly on window , disappears. alertdidend callback method never called. i've tried clean product in xcode 4.6.1 , rebuild it, without success. - (void) alertdidend:(nsalert *)alert returncode:(nsinteger)returncode contextinfo:(void *)contextinfo { [[alert window] orderout:self]; alertresult = returncode; nslog(@"alertdidend called"); } - (void) showalert { nsalert *savealert = [[nsalert alloc] init]; [savealert setalertstyle:nswarningalertstyle]; [savealert setmessagetext:messagetext]; [savealert setinformativetext:informativetext]; [savealert addbuttonwithtitle:defaultbuttontitle]; [savealert addbuttonwithtitle:secondbuttontitle]; [savealert beginsheetmodalforwindow:[self window] modaldelegate:self didendselector:@selector(alertdidend:returncode:contextinfo:) contextinfo:nil]

entity framework 4 - linq OrderBy property on object -

using ef4 possible orderby property on property, i.e. entitya has name property. entity b has few other properties , entitya. want list of entityb ordered entitya.name entityblist = _repo.find<entityb>() .orderby(x => x.entitya.name); why doesn't work? know it's not using ef4, concept same. using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; namespace linqorderbyreference { class program { static void main(string[] args) { entitya[] entitiesa = { new entitya { ordinal = 3, secretcode = "xxx"}, new entitya { ordinal = 2 ,secretcode = "x"}, new entitya { ordinal = 1 ,secretcode = "x"} }; entityb[] entitiesb = { new entityb { name = "c", entitya = entitiesa[2] }

Strange behavior of javascript events after pressing two keys at the same time -

i'm coding little javascript app , need control screen events (images appearance). example if image_1 appear on screem need press 1 key (for example right arrow) , if image_2 appear need press key (for instance left arrow). if both of them appear @ same time need press both keys. the problem if press both keys @ same time, no more key events launched, mean when next image appear press key there not javascript event. i make code simple try: <html lang="es"> <head> <meta charset="utf-8"> <title>test1</title> <script> function adde () { if (document.addeventlistener) {// standard w3c document.addeventlistener("keydown",test1,false); } } // ejemplo equivalente para quitar el evento function removee () { if (document.removeeventlistener) {// standard w3c dom document.removeeventlistener("keydown",test1,false);

MySQL query calling other SQL files to execute in order -

so have java ee application , use hibernate. have created import.sql file loaded each time start application. my issue database quite big, have startup data prepared in separate sql files, should load in order. so within sql script file need call or import or load other sql files in folder above 1 (path not problem). i grateful solution mysql , maybe oracle db (but mysql more important atm). this solution not working thanks! ok thing moment not possible load other query script files in 1 another. raw data load data infile , otherwise not possible.

javascript - Override settings of jQuery plugin? -

i've built plugin : ;(function ($,window,undefined){ ... ...default settings area... ...content area... ... })(jquery,window); but plugin can have many(!) configurations .(files configurations) so each configuration file can in js file . example : mysettings.js : var mysetings= {a:1,b:2.....} so problem : the settings file must loaded before plugin. ( plugin able read mysettings in override settings area ) the way communicate mysettings plugin via window object question : what correct way configure plugin can have many(!) settings via js file. as don't have code example work i'll give generalized solutions. collect settings object(s) in array , iterate on them within override settings area. expose plugin via window , directly append settings there. example 1 js //file 1.js window.settings = window.settings || []; window.settings.push({a:'11'}); //file2.js window.settings = window.settings || []; windo

javascript - How do I prompt iPhone/iPad visitors to install native app? -

Image
i've visited few sites on iphone/ipad have prompted me install native app first time i've visited site. there standard script somewhere people use or should create own? must have been thousands of times before despite endless googling can't find 'stock' script can use. ideally should use cookies user doesn't prompted more once month or so. apple have got built in way of doing relatively unobtrusively, adds "smart app banner" @ top of browser if app isn't installed: to add smart app banner website, include following meta tag in head of each page you'd banner appear: <meta name="apple-itunes-app" content="app-id=myappstoreid"> for more options, please see full documentation on apple's site: http://developer.apple.com/library/ios/#documentation/appleapplications/reference/safariwebcontent/promotingappswithappbanners/promotingappswithappbanners.html this adds nice looking banner top of page, ca

c - Function prototype filters -

this question has answer here: extracting c / c++ function prototypes 7 answers is there kind of tool shows function prototypes of given source file? know doxygen doing such thing, find simple linux command such as $ filter-function-prototypes main.c 1: print_hello() 2: main() where main.c given as #include <stdio.h> void print_hello() { printf("hello, world\n"); } int main() { print_hello(); } apparently ctags can that! ctags -x --c-kinds=f main.c there's stuff in output can handled sed or awk . or cut ctags -x --c-kinds=f cards.c | cut -c 51-

openSSL using Android's NDK problems -

i have following situation, porting piece of app using openssl aes encryption, have compile, linker fails. situation following: 1. wrote jni wrapper : private native string cipherstring(string plaindata, int datasize, string password, int passsize); private native string decipherstring(string ciphereddata, int datasize, string password, int passsize); next have c++ file call has proper jni sintax translates jstring char * , other needed transformations, , makes call cpp file imports openssl headers (present , accounted for) , calls openssl methods ciphering , deciphering. so when call ndk-build, builds thumbs, compiler compiles them correctly. next needed port openssl android, , used openssl android works char simple ndk-build (in root of project, ofcourse) , builds libssl.so , libcrypto.so so need connect two.. find challenge connect build scripts, 1 ndk-build compiles , linkes (i appreciate simple example project if has time it) so copied compiled libssl , libcrypto

gwt - Vaadin Touchkit or mgwt -

i evaluating possibilities create mobile hybrid apps gwt , apache cordova / phonegap. build small prototype mgwt , liked it, research few other possibilities before starting project. therefore took @ vaadin , addon touchkit. i have following questions: is possible use vaadin touchkit addon in client-side application not need permanent server connection? in mobile chapter of documentation example shown server-side application, far understand , therefore need server connection each ui event. please correct me if i'm wrong, have no experience vaadin. is there difference between "normal" gwt app , client-side vaadin app? does has advantages use vaadin touchkit instead of mgwt? in general vaadin touchkit comparable mgwt , if yes main differences? you can build vaadin touchkit applications work offline. "parking demo" shows this: http://demo.vaadin.com/parking/ (source code here : https://github.com/vaadin/parking-demo ) default, default app

objective c - Create 1 image from masked image in ios -

i have image , mask image image make shape. i want change view background color of masked image. i using [uicolor colorwithpatternimage:maskedimage]; but not working. please suggest me how merge or create masked 2 images in 1 image colorwithpatternimage work. uiimage *originalimage = [uiimage imagenamed:@"original.png"]; //my background image uiimage *maskedimage = [uiimage imagenamed:@"maskedimage.png"]; //my masked image cgsize newsize = cgsizemake(width, height); uigraphicsbeginimagecontext( newsize ); [originalimage drawinrect:cgrectmake(0,0,newsize.width,newsize.height)]; [maskedimage drawinrect:cgrectmake(0,0,newsize.width,newsize.height) blendmode:kcgblendmodenormal alpha:0.6]; uiimage *newmaskedbackgroundimage = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext(); then use newmaskedbackgroundimage, ex. [uicolor colorwithpatternimage:newmaskedbackgroundimage];

c++ - ifstream sets failbit when trying to read a textfile -

my problem "failbit" set directly when trying read textfile. strange thing, me @ least, if build program , run it, works. when try debug failbit sets. the actual error message this: "unhandled exception @ 0x7740c41f in steg1_1a.exe: microsoft c++ exception: std::ios_base::failure @ memory location 0x003bf8e4.." and text console program this: "ios_base::failbit set". the question is, how fix failbit doesn't "crash program" when debugging? here function: void selectedmenuchoice(int choice) { int index = 0, initvalue = 0; const int filenumbercount = 24; double numfromfile = 0.0, sum = 0.0, average = 0.0, max = 0.0, min = 0.0; switch (choice) { // "display temperature values" case 1: cout << "\ndisplaying latest 24 temperature values:\n\n"; break; // "view maximum , minimum temperatures" case 2: cout << "\ncalculating maximum , minimum tem

asp.net mvc - Url.Content for javascript -

i use approach obtain correct relative uri (independent of deployment situation). razor code (asp.net mvc 3): @section javascript { <script type="text/javascript"> var _geturl = "@url.content("~/bla/di/bla")"; </script> } separate js file: $.ajax({ url: _geturl, do reckon there better approach? personally prefer using html5 data-* attributes or including url part of dom element unobtrusively ajaxify. the thing never write $.ajax calls flying around that. write them correspond dom events. example clicking of anchor. in case it's trivial, use html helper generate anchor: @html.actionlink("click me", "someaction", "somecontroller", new { id = "123" }, new { @class = "link" }) and then: $('.link').click(function() { $.ajax({ url: this.href, type: 'get', success: function(result) { ...

algorithm - Integer logarithm of fractional bases -

i'm working on program problem has natural logarithmic scale. so far i'm using base 2, nice implementation of unsigned int log2(uint64_t) (in c/c++), found here . however, found base 2 problem: need use fractional bases, e.g. 3/2. is aware of implementation kind of operation? my current solution round(log(x)/log(base)) round returns integer, hopping, @ least, avoid 2 evaluations of log. log(base) constant, evaluate once , take reciprocal (to turn onto multiply rather expensive divide). const float k = 1.0f / log(base); // init constant once y = round(log(x) * k); // each evaluation requires 1 log, // 1 multiply , 1 round

c# - How to override Vertical Scroll behaviour in ListBox? -

i using list box wrappnael hold list of images in grid fashion. using mouse drag behaviors drag , drop items in listbox. not able drag item vertically or down because there vertical scrolling in listbox. how able drag item vertically not affecting scrolling behavior? try: <listbox scrollviewer.verticalscrollbarvisibility="disabled"></listbox> hope help.

Child Process Creation through fork() in C -

i'm new c , learning processes. i'm little confused code below doing, it's taken wikipedia i've seen in several books , unsure why, example, pid_t pid; pid = fork(); . reading seem suggest child process returns pid of 0 , however, thought original parent process maintain pid of 0 after seeing tree root pid 0 . what does, example, pid = fork(); parent? doesn't same thing child? , doesn't pid = fork(); put loop each child? basically, explain each step me if were, say, five? maybe younger? thanks! #include <stdio.h> /* printf, stderr, fprintf */ #include <sys/types.h> /* pid_t */ #include <unistd.h> /* _exit, fork */ #include <stdlib.h> /* exit */ #include <errno.h> /* errno */ int main(void) { pid_t pid; /* output both child , parent process * written standard output, * both run @ same time. */ pid = fork(); if (pid == -1) { /* error: * when fork() returns -1, error ha