Search Results

Search found 341 results on 14 pages for 'erik forbes'.

Page 11/14 | < Previous Page | 7 8 9 10 11 12 13 14  | Next Page >

  • Append a parent element to arrays in PHP for a foreach loop

    - by Erik Berger
    print_r of $data = json_decode($src, true); returns data that looks like this: Array ( [0] => Array ( [var1] => blah [var2] => foo ) [1] => Array ( [var1] => lorem [var2] => ipsum ) // goes down to [1936] ) I want to build an html table that shows var1 and var2 next to each other in the same row. I know do to this I need a foreach statement like foreach($data['items'] as $item) but the problem I think I am having is that my many arrays aren't the child of one thing like 'items', right? I looked into array_push but couldn't figure it out. Can someone help my orphaned parentless arrays?

    Read the article

  • How to log messages to a log file in a specific path from a bash script

    - by Erik
    How do you log messages to a log file in a specific path from a bash script? A naive implementation would be commands like: echo My message >>/my/custom/path/to/my_script.log But this probably has many disadvantages (no log rotation for example). I could use the 'logger' command, but it does not support logs in custom paths as far as I know and is not easy to configure if you have lots of bash scripts that could use a custom log file. In a scripting language like Ruby all this is quite easy: https://github.com/rudionrails/yell/wiki/101-the-datefile-adapter I could also make my own logger command based on this ruby library and call it from my bash scripts, but I guess there is already a well known solution that provides similar behavior for shell scripts?

    Read the article

  • Using an SHA1 with Micrsoft CAPI

    - by Erik Jõgi
    Hello, I have an SHA1 hash and I need to sign it. The CryptSignHash() method requires a HCRYPTHASH handle for signing. I create it and as I have the actual hash value already then set it: CryptCreateHash(cryptoProvider, CALG_SHA1, 0, 0, &hash); CryptSetHashParam(hash, HP_HASHVAL, hashBytes, 0); The hashBytes is an array of 20 bytes. However the problem is that the signature produced from this HCRYPTHASH handle is incorrect. I traced the problem down to the fact that CAPI actually doesn't use all 20 bytes from my hashBytes array. For some reason it thinks that SHA1 is only 4 bytes. To verify this I wrote this small program: HCRYPTPROV cryptoProvider; CryptAcquireContext(&cryptoProvider, NULL, NULL, PROV_RSA_FULL, 0); HCRYPTHASH hash; HCRYPTKEY keyForHash; CryptCreateHash(cryptoProvider, CALG_SHA1, keyForHash, 0, &hash); DWORD hashLength; CryptGetHashParam(hash, HP_HASHSIZE, NULL, &hashLength, 0); printf("hashLength: %d\n", hashLength); And this prints out hashLength: 4 ! Can anyone explain what I am doing wrong or why Microsoft CAPI thinks that SHA1 is 4 bytes (32 bits) instead of 20 bytes (160 bits). Thank you.

    Read the article

  • How to make a secure login using UDID or device token?

    - by Erik B
    So I'm making an app where I want the users to be able add, edit and rate content, but I do not want to force them to register. Instead I was planning on just using their device id or device token to identify them. I'm planning on making both an iPhone and Android version, so I'm looking for a general solution, but the iPhone version has higher priority, so an iPhone specific solution would also be welcome. The problem is that I don't want just anyone to be able to use my web service by sending a phony device id or someone else's device id. How would the client prove to the server that it is providing the correct device id?

    Read the article

  • Partitioning a table in mysql after creation

    - by erik
    I have a table with a bunch of data already in it. I know how to create a partitioned table or alter an already existing partitioned table, but can I add partitions to a table after it has been created, has data in it, without losing the data? The other option is to dump all the data, recreate the table with the partitions and then insert it all back it. Is that the only way? Thanks.

    Read the article

  • Wordpress loginform

    - by Erik Larsson
    Hello, I have created a loginform that is displayed on the front page. Everything works fine except one thing, if you log in with bad information you get redirected to wp-login.php and the error message pans out there. What i want is so the error message displays at the form on my front page. Is there way of doing this?

    Read the article

  • Does Java Mac OSX native look and feel respect UIManager font changes?

    - by Erik Lickerman
    I have a java applet and the only look and feel that works properly is the native mac one. I wanted to make the fonts a bit larger and tried using the standard UIManager methods UIManager.put("Label.font", new Font("Georgia", Font.PLAIN, 18)); This produces no change. It does not throw an exception, of course. Does anyone know if the native mac look and feel ignores these? I know there are specific ways to make controls different sizes on mac but these only seem to make them smaller. You cannot make the controls larger than regular.

    Read the article

  • Options for displaying OG groups a node is published for on node page?

    - by Erik Töyrä
    What I want I have several OG groups in which content can be published. I would like to display which OG groups a node has been published for when viewing the node page. Like in "This page is published for: Department A, Department B." The code snipped below shows the data I have in the $node object in node.tpl.php. This data is generated by the OG module. Extracted data from $node ... [og_groups] => Array ( [993] => 993 [2078] => 2078 ) [og_groups_both] => Array ( [993] => Department A [2078] => Department B ) ... I know I could loop through the og_groups_both array in node.tpl.php and generate the output from there, but it feels like a quite dirty solution. The ideal solution would be to have a $og_groups variable in node.tpl.php, similiar to how $submitted is used in node.tpl.php (see below). Example of how $submitted is used <?php if ($submitted): ?> <div class="submitted"><?php print $submitted; ?></div> <?php endif; ?> Should I use hook_load() in a custom module to insert the new variable $og_groups in $node? What options do I have and which solution would you recommend?

    Read the article

  • Fetch the most viewed data in databases

    - by Erik Edgren
    I want to get the most viewed photo from the database but I don't know how I shall accomplish this. Here's my SQL at the moment: SELECT * FROM photos AS p, viewers AS v WHERE p.id = v.id_photo GROUP BY v.id_photo The databases: CREATE TABLE IF NOT EXISTS `photos` ( `id` int(10) NOT NULL AUTO_INCREMENT, `photo_filename` varchar(50) NOT NULL, `photo_camera` varchar(150) NOT NULL, `photo_taken` datetime NOT NULL, `photo_resolution` varchar(10) NOT NULL, `photo_exposure` varchar(10) NOT NULL, `photo_iso` varchar(3) NOT NULL, `photo_fnumber` varchar(10) NOT NULL, `photo_focallength` varchar(10) NOT NULL, `post_coordinates` text NOT NULL, `post_description` text NOT NULL, `post_uploaded` datetime NOT NULL, `post_edited` datetime NOT NULL, `checkbox_approxcoor` enum('0','1') NOT NULL DEFAULT '0', PRIMARY KEY (`id`), UNIQUE KEY `id` (`id`) ) CREATE TABLE IF NOT EXISTS `viewers` ( `id` int(10) NOT NULL AUTO_INCREMENT, `id_photo` int(10) DEFAULT '0', `ipaddress` text NOT NULL, `date_viewed` datetime NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `id` (`id`) ) The data in viewers looks like this: (1, 85, '3892a0ab97d6ff325f285b27b847070f', '2012-06-21 22:49:25'), (2, 84, '3892a0ab97d6ff325f285b27b847070f', '2012-06-21 22:49:25'), (3, 85, '3892a0ab97d6ff325f285b27b847070f', '2012-06-21 22:49:25'); One single row from the database for photos to understand how the rows looks like in this database: (85, 'P1170986.JPG', 'Panasonic DMC-LX3', '2012-06-19 18:00:40', '3968x2232', '10/8000', '80', '50/10', '51/10', '', '', '2012-06-19 18:45:17', '0000-00-00 00:00:00', '0') At the moment the SQL only prints the photo with ID 84. In this case it's wrong - it should print out the photo with ID 85. How can I fix this problem? Thanks in advance.

    Read the article

  • Cookie is setting twice (duplicated)

    - by Erik Larsson
    I'm new to cookies, and im trying to set a cookie where to store the referrer (the org ref). But when i try this function: function do_it_cookie() { // Check if cookie exists if (isset($_COOKIE['ref'])) { // It dose exist, do nothing or anything... } else { setcookie ('ref', $_SERVER['HTTP_REFERER'], time() + 60, '/'); header ("Location: http://www.nyttforetag.com/mind-your-own-business/"); } } I want to store the cookie on the user computer for 30 days, if the return i want to know the initial refereeing url. But when i use this and lets say i go to another page in my site and then go back to the homepage its sets a new cookie with the exact same name and with the ref of the previous page. Is there away to avoid this?

    Read the article

  • Remove a layer from a ggplot2 chart

    - by Erik Shilts
    I'd like to remove a layer (in this case the results of geom_ribbon) from a ggplot2 created grid object. Is there a way I can remove it once it's already part of the object? library(ggplot2) dat <- data.frame(x=1:3, y=1:3, ymin=0:2, ymax=2:4) p <- ggplot(dat, aes(x=x, y=y)) + geom_ribbon(aes(ymin=ymin, ymax=ymax), alpha=0.3) + geom_line() # This has the geom_ribbon p # This overlays another ribbon on top p + geom_ribbon(aes(ymin=ymin, ymax=ymax, fill=NA))

    Read the article

  • Cookie is setting twice (dublicated)

    - by Erik Larsson
    I'm new to cookies, and im trying to set a cookie where to store the referer (the org ref). But when i try this function: function do_it_cookie() { // Check if cookie exists if (isset($_COOKIE['ref'])) { // It dose exist, do nothing or anything... } else { setcookie ('ref', $_SERVER['HTTP_REFERER'], time() + 60, '/'); header ("Location: http://www.nyttforetag.com/mind-your-own-business/"); } } I want to store the cookie on the user computer for 30 days, if the return i want to know the initial refereeing url. But when i use this and lets say i go to another page in my site and then go back to the homepage its sets a new cookie with the exact same name and with the ref of the previous page. Is there away to avoid this?

    Read the article

  • delete vs execSQL commands android

    - by erik
    so i have a databas, SQLiteDatabase db I am writing a couple private methods in my manager class that will be called by a public method: public void updateData (MakeabilityModel newData){ SQLiteDatabase db = this.getWritableDatabase(); db.beginTransaction(); try { reWriteSVTable(db, list); db.setTransactionSuccessful(); } catch (Exception e){ //TODO through rollback message? e.printStackTrace(); } finally { db.endTransaction(); } } //Private Methods private void clearTable(SQLiteDatabase db, String table){ db.delete(table, null, null); } private void reWriteSVTable(SQLiteDatabase db, List<MakeabilityLens> lenses){ clearTable(db, singleVision); ContentValues cv; for(int i=0; i<lenses.size(); i++){ cv = new ContentValues(); cv.put(colScreenID, hsID); cv.put(colIconID, id); cv.put(colRank, hsTotal); db.insert(isLookUp, colID, cv); } } My question is this.. i want to be able to throw sql exceptions back to the public method so that if there is an exception, it will kill the transaction and rollback ALL data.. it appears that using delete() and insert() methods are cleaner than execSQL() but don't throw sqlExceptions. execSQL() on the other hand does? do i need to uses execSQL and how do i insure that hsould it throws an exception in any of the private methods that it will catch it and roll it back in the private method

    Read the article

  • java will this threading setup work or what can i be doing wrong

    - by Erik
    Im a bit unsure and have to get advice. I have the: public class MyApp extends JFrame{ And from there i do; MyServer = new MyServer (this); MyServer.execute(); MyServer is a: public class MyServer extends SwingWorker<String, Object> { MyServer is doing listen_socket.accept() in the doInBackground() and on connection it create a new class Connection implements Runnable { I have the belove DbHelper that are a singleton. It holds an Sqlite connected. Im initiating it in the above MyApp and passing references all the way in to my runnable: class Connection implements Runnable { My question is what will happen if there are two simultaneous read or `write? My thought here was the all methods in the singleton are synchronized and would put all calls in the queue waiting to get a lock on the synchronized method. Will this work or what can i change? public final class DbHelper { private boolean initalized = false; private String HomePath = ""; private File DBFile; private static final String SYSTEM_TABLE = "systemtable"; Connection con = null; private Statement stmt; private static final ContentProviderHelper instance = new ContentProviderHelper (); public static ContentProviderHelper getInstance() { return instance; } private DbHelper () { if (!initalized) { initDB(); initalized = true; } } private void initDB() { DBFile = locateDBFile(); try { Class.forName("org.sqlite.JDBC"); // create a database connection con = DriverManager.getConnection("jdbc:sqlite:J:/workspace/workComputer/user_ptpp"); } catch (SQLException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } } private File locateDBFile() { File f = null; try{ HomePath = System.getProperty("user.dir"); System.out.println("HomePath: " + HomePath); f = new File(HomePath + "/user_ptpp"); if (f.canRead()) return f; else { boolean success = f.createNewFile(); if (success) { System.out.println("File did not exist and was created " + HomePath); // File did not exist and was created } else { System.out.println("File already exists " + HomePath); // File already exists } } } catch (IOException e) { System.out.println("Maybe try a new directory. " + HomePath); //Maybe try a new directory. } return f; } public String getHomePath() { return HomePath; } private synchronized String getDate(){ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date date = new Date(); return dateFormat.format(date); } public synchronized String getSelectedSystemTableColumn( String column) { String query = "select "+ column + " from " + SYSTEM_TABLE ; try { stmt = con.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); ResultSet rs = stmt.executeQuery(query); while (rs.next()) { String value = rs.getString(column); if(value == null || value == "") return ""; else return value; } } catch (SQLException e ) { e.printStackTrace(); return ""; } finally { } return ""; } }

    Read the article

  • Intellisense in Visual Studio 2010

    - by Erik
    For some reason the Intellisense in vb.net stopped working when I use an Aggregate Lambda expression inside a With statement. With Me.SalesPackage .WebLinks = Sales.Where(Function(f) f.Current.BookerWeb > 0).Count .WebAmount = Aggregate o In Sales.Where(Function(f) f.Current.WebBooker > 0) Into Sum(o.Current.WebPrice) End With If I insert a new line between .WebLinks and .WebAmount and start typing, it works. But it won't work if I do it after the Aggregate statement... Any ideas?

    Read the article

  • ctrl+click or shift+click not always firing the onclick event

    - by Erik
    Hi, I recently discovered that different browsers handle the onclick event differently when the control of shift key is pressed. Same thing for following links with the middle mouse button. <a href="http://www.example.com/" onclick="alert('onclick');">go to example.com</a> Onclick browser support table Mouse Keyboard Chrome Firefox Safari Opera IE5.5 IE6 IE7 IE8 IE9 Left None yes yes yes yes yes yes yes yes yes Left Ctrl yes yes yes yes ? yes no no ? Left Shift yes yes yes yes ? yes yes yes ? Middle None yes no yes no ? N/A no no ? Can someone please fill in the question marks for me? Also; I'm wondering if the behaviour differs for each version of Chrome, Firefox, Safari and Opera. Finding a logical pattern in this behaviour would be even nicer, but I don't think there is :). Thanks a lot.

    Read the article

  • Can you call FB.login inside a callback from other FB methods (like FB.getLoginStatus) without triggering popup blockers?

    - by Erik Kallevig
    I'm trying to set up a pretty basic authentication logic flow with the FB JavaScript SDK to check a user's logged-in status and permissions before performing an action (and prompting the user to login with permissions if they are not)... User types a message into a textarea on my site to post to their Facebook feed and click's a 'post to facebook' button on my site. In response to the click, I check user's logged in status with FB.getLoginStatus In the callback to FB.getLoginStatus, if user is not logged in, prompt them to login (FB.login). In the callback to FB.login I then need to make sure they have the right permissions so I make a call to FB.api('/me/permissions') -- if they don't , I again prompt them to login (FB.login) The problem I'm running into is that anytime I try to call FB.login inside a callback to other FB methods, the browser seems to lose track of the origin of execution (the click) and thus will block the popup. I'm wondering if I'm missing some way to prompt the user to login after checking their status without the browser mistakenly thinking that it's not a user-initiated popup? I've currently fallen back to just calling FB.login() first regardless. The undesired side effect of this approach, however, is that if the user is already logged-in with permissions and I'm still calling FB.login, the auth popup will open and close immediately before continuing, which looks rather buggy despite being functional. It seems like checking a user's login status and permissions before doing something would be a common flow so I feel like I'm missing something. Here's some example code. <div onclick="onClickPostBtn()">Post to Facebook</div> <script> // Callback to click on Post button. function onClickPostBtn() { // Check if logged in, prompt to do so if not. FB.getLoginStatus(function(response) { if (response.status === 'connected') { checkPermissions(response.authResponse.accessToken); } else { FB.login(function(){}, {scope: 'publish_stream'}) } }); } // Logged in, check permissions. function checkPermissions(accessToken) { FB.api('/me/permissions', {'access_token': accessToken}, function(response){ // Logged in and authorized for this site. if (response.data && response.data.length) { // Parse response object to check for permission here... if (hasPermission) { // Logged in with permission, perform some action. } else { // Logged in without proper permission, request login with permissions. FB.login(function(){}, {scope: 'publish_stream'}) } // Logged in to FB but not authorized for this site. } else { FB.login(function(){}, {scope: 'publish_stream'}) } } ); } </script>

    Read the article

  • La loi de Moore a-t-elle encore un avenir ? Oui, répond un ingénieur, si les développeurs se mettent

    La loi de Moore est elle encore pertinente ? Plus pour les CPU, répond un responsable de Nvidia qui appelle au développement de la programmation parallèle Bill Dally est un des ingénieurs les plus importants de Nvidia. Dans une tribune publiée dans le magasine Forbes, l'ingénieur en chef doute fortement que la loi de Moore puisse encore s'appliquer aux processeurs (CPU) : « Les performances des CPUs ne peuvent plus doubler tous les 18 mois », constate-t-il, « et cela va poser un grave problème à de nombreuses industries qui reposent sur cette croissance des performances ». Optimiste, Bill Dally en tire cependant une raison d'espérer « La bonne nouvelle, c'e...

    Read the article

  • Do you know what is a DevOps Project?

    - by Gopinath
    Yesterday I wrote about OpenStack project, an open source cloud computing stack that lets you build Cloud Computing environments. While reading more on this topic I stumbled about a new type of projects called DevOps projects.  OpenStack is all set to become the first DevOps project, reports Forbes …the way OpenStack is applying the open source model to creating cloud infrastructure, the open source model is on the verge of being extended so that the collaboration and design process will include software, hardware, and networking in the data center as well as operational processes. In modern development, the idea of designing software, data center, and operations using one integrated team is called DevOps.

    Read the article

  • Did Microsoft Add Wiretapping Capability to Skype?

    Ryan Gallagher, writing for Slate, put two and two together from a lot of no comments. He noted that back in 2007, German police forces said that they couldn't tap into Skype calls because of of its strong encryption and complicated peer-to-peer network connections; in fact, Skype bluntly stated at the time that, due to its encryption and architecture techniques, it couldn't conduct wiretaps. But that may have changed. Gallagher cited a Forbes article that claims the hacker community is talking about recent changes to Skype's architecture and whether they will allow users to be wiretapped. ...

    Read the article

  • Mobile Application development - get hands on at UKOUG

    - by Grant Ronald
    Development of mobile solutions is one of the hottest topics in the IT market at the moment.  Forbes predicts that mobile application development with outstrip native PC development by 4-1 by 2015.  I'm therefor delighted to announce that the UKOUG and Oracle have synch'd up to provide a rolling 3 day hands-on Mobile development lab at the UKOUG conference this year. We're setting up a lab of 10 Mac machines in which you will be able to develop iOS on-device applications.  And the great thing is, if you want to develop for Android, its the same lab as well!  Just think, write once and deploy to iOS or Android.  We know places will be limited so we are going to be putting in place a first-come-first-served booking system.  Walk-ups will be allowed only if places are free. This is your chance to start skilling up on the hottest development initiative in years.

    Read the article

< Previous Page | 7 8 9 10 11 12 13 14  | Next Page >