w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How to combine two multidimensional arrays with showing duplicate keys or if duplicate, must add the values
$array1 = array( 'a1' => array(200,300,300), 'a2' => array(100,600,200)); $array2 = array( 'a1' => array('gen','gen2','gen'), 'a2' => array('gen2','gen3','gen3')); $result = array('a1' => array(), 'a2' => array()); foreach($array2 as $k => $v) { foreach ($v as $k2 => $v2){ if (array_key_exists($v2, $result[$k])){ $result[$k][$v2] += $array1[$k][$k2]; } else { $result[$k][$v2] = $array1[$k][$k2]; } } } Output: Array ( [a1] => Array ( [gen] => 500 [gen2] => 300 ) [a2] => Array ( [gen2] => 100 [gen3] => 800 ) )

Categories : PHP

Hudson server running app engine, duplicate shell script executions result in duplicate property errors
It might be the case that the dev_appserver is already running and then you run it again with hudson job. The best way will be to stop the dev_appserver instance first and then pump it up again.

Categories : Python

chrome.windows.onFocusChanged.addListener fired when closing Chrome, crashing plugin
chrome.tabs.getCurrent is a method: it's not an instance of a Tab object. You should try this: chrome.windows.onFocusChanged.addListener(function() { chrome.tabs.getCurrent(function(ctab) { chrome.tabs.executeScript(ctab.id, { file: "inject.js" }); }); }); Reference: http://developer.chrome.com/extensions/tabs.html#method-getCurrent

Categories : Javascript

Chrome Extension API: chrome.tabs.captureVisibleTab on Background Page to Content Script
Use chrome.tabs.sendMessage background page: chrome.runtime.onMessage.addListener( function(request, sender, sendResponse) { chrome.tabs.captureVisibleTab( null, {}, function(dataUrl) { sendResponse({imgSrc:dataUrl}); } ); //remember that captureVisibleTab() is a statement return true; } ); content script chrome.runtime.sendMessage({msg: "capture"}, function(response) { console.log(response.dataUrl); });

Categories : Javascript

Unable to trigger chrome.browserAction.onClicked.addListener with google chrome extensions
If you define default_popup, you can't have a listener for browserAction.onClicked. In this case you can simply add the code in your handler to your popup.js. EDIT: That is, add to popup.js the following: chrome.tabs.executeScript(null, {code:"document.body.bgColor='red'"});

Categories : Google Chrome

Why when launching Chrome and loading html file to chrome it's taking so much time to load it?
I think that is because the page you are trying to load has its html part in other file and other elements belonging to same page are in a folder,not to mention designer webpages and sites have hundreds and thousands of elements in them.From elements i mean separate stylesheets,separate script files,graphics such as images including site banner and others etc.Assigning hundreds of elements to correct places obviously takes some time. My opinion would be to first change the following setting in Chrome(To change them type 'chrome://flags' (without quotes) and press Enter button this will bring you to internal settings page of Chrome).Once you have settings page opened locate following setting Save Page as MHTML and Enable it,then try to download the page again.Then use this co

Categories : C#

How do I get the the google chrome chrome.windows.create extension function to work
inline javascript codes are not allowed (by default) in chrome extensions. so you have to change the code like this. <html> <head> </head> <body> </body> <script src="loader.js"></script> loader.js: function load() { chrome.windows.create({ url: 'http://www.google.com', type: 'panel' }); } document.getElementsByTagName( 'body' )[0].onload = function() { load(); }; For more information about content-security policies visit: Content Security Policy (CSP) - Google Chrome

Categories : Google Chrome

how to implement Chrome extension 's chrome.tabs.sendMessage API in Firefox addon
In add-ons build using the Add-on SDK, content scripts are managed by main.js. There's no built-in way to access all of your add-on's content scripts. To send a message to all tabs, you need to manually keep track of the content scripts. One-way messages are easily implemented by the existing APIs. Callbacks are not built-in, though. My browser-action SDK library contains a module called "messaging", which implements the Chrome messaging API. In the following example, the content script and the main script use an object called "extension". This object exposes the onMessage and sendMessage methods, modelled after the Chrome extension messaging APIs. The following example adds a content script to every page on Stack Overflow, and upon click, the titles of the tabs are logged to the consol

Categories : Javascript

Chrome issue : Enable/Disable sorting on columns fails in chrome in GWT
The issue is resolved by deferring redrawHeaders() call Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { _table.redrawHeaders(); } }); }

Categories : Gwt

return value of chrome.webRequest.onBeforeRequest based on data in chrome.storage
You can just swap the callbacks: chrome.storage.local.get({requests: []}, function (cache) { chrome.webRequest.onBeforeRequest.addListener(function (request) { if(cache.requests[0].item === 0) return { cancel: true }; }); }); This makes sense because instead of requesting storage on each request, you only listen to requests after you have the storage in the memory. The only downside to this method is that if you are updating the storage after starting listening, it won't take effect. To solve this, remove the listener and add it again: var currentCallback; function startListening() { chrome.storage.local.get({requests: []}, function (cache) { chrome.webRequest.onBeforeRequest.addListener(function (request) { currentCallback = t

Categories : Javascript

Make chrome icon on windows taskbar glow when chrome is minimized
I found this piece of code, can't test is right now because i'm not using windows, but you should give it a try. <script type="text/javascript"> // Flashing TaskBar setInterval(flashToolbar, 10000); // calls flashToolbar every 10000 ms function flashToolbar() { if (window.external.msIsSiteMode()) { window.external.msSiteModeActivate(); } } </script> source: http://blogs.msdn.com/b/jennifer/archive/2011/05/10/ie-pinned-sites-part-8-how-to-implement-a-flashing-taskbar-button.aspx

Categories : Javascript

chrome.runtime.lastError is coming as 'UNDEFINED' despite of fetching an unset variable from chrome local storage,
Non-existence of the value is not an API error, hence chrome.runtime.lastError is not set. If you want to know whether the variable is set or not, check the results: chrome.storage.local.get('testVar1', function(result) { if (result.testVar1 === undefined) { alert('Var not set'); return; } // Rest of code... });

Categories : Javascript

Is there a way for a packaged hosted chrome extension to request chrome updates it?
Have you tried using chrome.runtime.requestUpdateCheck()? Your code could be something like this: chrome.runtime.requestUpdateCheck(function(status,details){}); chrome.runtime.onUpdateAvailable(function(details){ console.log('Updating to version: ' + details.version); chrome.runtime.reload(); });

Categories : Google Chrome

Menu items break on Chrome/Safari (Mac) but not on Firefox and Chrome for Win
This is probably because Chrome is rendering the fonts slightly differently and there will be a few pixels difference (about 4 or 5px over the screen width in this case). Here's a little trick I picked up a while ago to center the nav without padding and such: .site-header .site-nav ul { display: table; margin: 0 auto; } .site-header .site-nav li { display: block; float: left; } Notice there's no other margins or padding on the ul apart from the auto left and right. You'll also need to clear the ul with a clearfix because the li's are now floated. Or if you don't like using display:table you can do the same with display:inline-block on the ul, then set text-align:center on the .site-nav

Categories : HTML

chrome.app.isInstalled always returns false for Google Chrome extensions?
See chrome.app.isInstalled Always Returns as "false": chrome.app.isInstalled is meant for use by hosted apps (which define a set of URLs that encompass the app). Extensions can instead indicate that they're installed already by injecting a DOM node into the page (see second half of https://developers.google.com/chrome/web-store/docs/inline_installation#already-installed). That link describes a strategy for testing if your extension is installed: Have a content script inject a DOM node into every page. This node should have a very specific ID, e.g., <div id='my-extension-installed-with-id-sdgdthsdfgdtyjufwknsdkos'> On button press, have your page test if that node exists. If the node exists, the content script is running; therefore, the extension is installed. If it does not e

Categories : Google Chrome

Porting Chrome extension to Firefox : equivalent to chrome.storage
Yes exactly, it is simple-storage. You can use it like this : const storage = require("sdk/simple-storage").storage; storage.tokenFu = token;

Categories : Javascript

Chrome extensions: make chrome.tabs.query() synchronous
Unless there is some hidden functionality in the query function this is not possible. http://developer.chrome.com/extensions/tabs.html#method-query

Categories : Javascript

Chrome extension: Execute background page only once when chrome starts
What you are using is an Event Page(background_page.js). Event pages are unloaded when the browser detects that the page is not doing anything. So what's happening is that when you open a new tab, the Event page is being reloaded and starts executing from the top again. This way chrome is able to have your app use less memory and speed up the browser. If you want to fix the problem simply use persistent:true which will make sure the page "persists" indefinitely or until the user closes the browser. If you would really like to keep your app efficient with memory, you should take a look at the runtime.onSuspend method which gets called each time your Event page unloads. This way you can save stuff before the page gets unloaded so that you can resume where you left off.

Categories : Google Chrome

Using jQuery with Google Chrome Apps not Chrome Extenstions
From your code it's hard to say (of course), but obviously you have different paths for jquery-1.9.0.js and for your mainApp.js :-) I'm talking about a dot in manifest.json: "js": [ "./js/jquery-1.9.0.js", "js/jquery-ui-1.10.0.custom.min.js", "js/mainApp.js" ]

Categories : Jquery

Google Chrome Apps: chrome.storage.local
This is probably http://code.google.com/p/chromium/issues/detail?id=277647. Fix is in the works for Chrome 31.

Categories : Javascript

How do I include a Chrome Javascript API in the background.js in a Chrome Packaged App?
You have a typo. instead of "frame('none')", it should read {frame:'none'}. It's not launching because you're trying to call frame as a function. chrome.app.window.create wants an object as the second argument.

Categories : Javascript

a href to chrome:// url in a chrome extension how to make it work
You cannot access chrome pages from an extension. However you could get some settings with Chrome APIs Specifically Bookmarks API, Installed extensions API

Categories : Api

HTML5 Video Chrome - ffmpeg - mp4 working in all but Chrome
The solution is to use the parameter "-pix_fmt yuv420p": ps>ffmpeg.exe -i $input$file -y -strict experimental -acodec aac -ac 2 -ab 160k -vcodec libx264 -s 640x480 -pix_fmt yuv420p -preset slow -profile:v baseline -level 30 -maxrate 10000000 -bufsize 10000000 -b 1200k -f mp4 -threads 0 $output$file.iphone.mp4 ffmpeg version N-46936-g8b6aeb1 Hopes this can help you with getting chrome compatible videos Update1 See reference it may help you

Categories : HTML

Ask Chrome to process a HTTP request from a Chrome Extensions
Are you simply asking about XmlHTTPRequest? From your question, that seems to be what you want. To put it another way, you haven't given any special constraints on your problem that rule out the usual approach to this problem. By the way, in your question you mention both Chrome Apps and tabs, which generally don't mix.

Categories : Javascript

Chrome packaged apps : Open tab in chrome browser
Try dynamically creating a link and call its click method. function openTab(url) { var a = document.createElement('a'); a.href = url; a.target='_blank'; a.click(); } You could then call that function like this: openTab('http://google.com'); Update The previous example opens the link in the default browser (which could be something other than Chrome) If you want to force the link to open in chrome, use window.open window.open('http://google.com');

Categories : Javascript

Difficulties saving URL from Chrome tab (for Chrome extension)
This is because when you declare your "query" variable, it only has scope within your callback function in chrome.tabs.query. Now, you could declare your variable at the top of your script to give it scope within the entire script: var query; chrome.tabs.query({'active': true}, function (tabs) { query = tabs[0].url; }); chrome.browserAction.onClicked.addListener(function(activeTab) { var stemURL = "http://www.google.com/#q=link:"; chrome.tabs.create({ url: (stemURL + query) }); }); ...or you could use your activeTab variable that chrome.browserAction.onClick passes to you and grab the active tab's URL from that to ensure that you open the search results for the tab that the user was viewing when they clicked your extension's button, which would also have the added advantage

Categories : Javascript

@Fontface working on Mac Chrome, but NOT on Windows Chrome?
Try putting it in this format, generated with Font Squirrel. @font-face { font-family: 'ConsolasRegular'; src: url('consolas/consolas-webfont.eot'); src: url('consolas/consolas-webfont.eot?#iefix') format('embedded-opentype'), url('consolas/consolas-webfont.woff') format('woff'), url('consolas/consolas-webfont.ttf') format('truetype'), url('consolas/consolas-webfont.svg#ConsolasRegular') format('svg'); font-weight: normal; font-style: normal; } You'll need to change the font-family and the paths, as well as the name after the hash for SVG.

Categories : HTML

How to use chrome.alarms for Google Chrome extension
You didn't create any alarm, so no onAlarm event will be fired. Create an alarm with chrome.alarms.create. Note: you should do it in the chrome.runtime.onInstalled event.

Categories : Javascript

What are differences between Chrome on Android and Desktop Chrome?
Main difference is that Android don't have Flash because of the HTML5 implementation, and also there's a lot of different screen sizes and users don't like to zoom in and out a pan and zoom again, so the best you can do is to create a web designed for mobile devices. On the other hand, if your site is mainly HTML and Javascript, will work 100% on mobile Chrome. I have a HTML5 game and works equal in desktop and mobile. Also, you can download the Android SDK and test your site in a bunch of different Android versions and screen sizes with the AVD, is like an official Android emulator.

Categories : Android

Retrieving the state of Google Chrome preferences, like "Continue running background apps when Google Chrome is closed"?
You cannot read the state of Google Chrome preferences. Google does not provide an API for Chrome, "system" settings, and Google blocks general reads to the file system (You can read sandboxed files only). isAllowedIncognitoAccess()Doc just reports wether the extension is allowed in "Incognito mode", AKA "porn mode". It has nothing to do with whether background apps run. Currently, Chrome's high-level settings are stored in a JSON file named Local State in the User Data folder1. If you can find a way to read this file, the "Continue running background apps when Google Chrome is closed" setting is stored in the background_mode property. 1 The User Data folder defaults to: Windows XP: %AppData%..Local SettingsApplication DataGoogleChromeUser Data Windows Vista/7/8: %Loca

Categories : Google Chrome

Google Chrome - how can i programmatically enable chrome://flags some of the modules from disable mode to enabled mode?
Almost every Chrome flag can be set via the command line. Here is a quite exhaustive list of command line parameters, but also keep in mind that there would be even more in newer versions! EDIT: Here is the Comprehensive, up-to-date list of Chrome command line switches So basically you would launch chrome with these command line flags already set. That's the best way to go about it. You cannot manually set this using Javascript or other behavior. The only way you can set this programmatically (other than command line flags) is to use Capybara (a tool that can open and control browsers, generally used for running automated tests), open Chrome and then manually navigate to "chrome://flags" and click the necessary combo boxes. EDIT: Watir is also as good as Capybara Watir is another brow

Categories : Javascript

chrome APP - node.js - PUT is working, but Chrome says it's not
Why not ditch CORS altogether and add permission to localhost in your manifest? Also, take a look at AJAX request failing even though CORS headers are present, which outlines what seems to be a very similar problem. Apparently there have been problems with CORS requests originating from localhost. Perhaps there are similar problems where the requests originate from chrome-extension://... Sorry I don't have a more definitive answer!

Categories : Node Js

Find duplicate values in an array which creates a new array with key as duplicate keys and values as the dupes
This should do what you want. Loop over the array, and see if the value was already in there. If so, add it to the result. $arr_duplicates = array(); foreach($array as $k=>$v){ // array_search returns the 1st location of the element $first_index = array_search($v, $array); // if our current index is past the "original" index, then it's a dupe if($k != $first_index){ $arr_duplicates[$k] = $first_index; } } DEMO: http://ideone.com/Kj0dUV

Categories : PHP

Is there any way to hide Chrome window and capture a screenshot or convert the Chrome window to image?
edit I've added a process refresh and thread wait that should fix the problem of not having a MainWindowHandle when Chrome launches. Things to note: Process.Refresh will only work if another instance of chrome is NOT running (if chrome is already running the new Process will cause a new tab to be opened and will exit, hence process.Refresh will fail) - other approaches are possible to avoid this problem. The thread sleep value might need to be tweaked for your needs, but some sort of wait period is necessary for the window handle to be created and the page to load. end of edit this should do it it starts a process (notepad.exe in this case) waits until it's loaded for user input and gets the main window handle takes a print screen of the given process (I've used the solution Mauric

Categories : C#

Chrome WebDriver On Mac IllegalStateException After Setting Webdriver.Chrome.Driver property
Needed to setup the proper DesiredCapabilities object for chrome before the browser started to launch correctly. Also needed to remove the "" from my properties file (which resolved the IllegalStateException).

Categories : Java

Chrome extension or chrome app?
Either, or... Go with an extension if you'd like. I assume you've looked at the API reference? https://developers.google.com/google-apps/calendar/ From there, I'd imagine you'd just need OAuth to authenticate the user. Here's the JS library: https://code.google.com/p/google-api-javascript-client/

Categories : Google Chrome

can android Google chrome be controlled as iOS Google Chrome
It's not exactly the same but you should investigate the use of Android Intents. Android is already designed around a system of launching tasks having them stacked and the user being able to press the back button to get back to the calling app or site. You can't check if Chrome is installed but you can force a url to be opened in Chrome from an app using intents, and you can't stop it from opening a tab if the users chooses so, but intents get you to a place that is close.

Categories : Android

html5 geoloaction is not working in chrome/windows7 . But its working in chrome / XP ...Is there any issue with html5
This should give you the error you are looking for. It doesn't work on my chrome win 7 and the error is user permission denied when running locally, but not when uploaded to a server. Might try getting this onto a server instead of running with the file:/// protocol. Should do the trick. Chrome is pesky about what it allows when running locally. $(document).ready(function(){ if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(showPosition, showError); function showPosition(position) { var currentLatitude = position.coords.latitude; var currentLongitude = position.coords.longitude; alert(currentLongitude); localStorage.DeviceLocation=currentLatitude+","+currentLongitude;

Categories : Javascript

PDO duplicate row
You should be able to insert into dreamyAuctions with a straight select from the same table for the given auction_id - you just have to list all the fields with the exception of auction_id as this is the primary key (assumption) and cannot be duplicated. INSERT INTO `dreamyAuctions`(`category`,`type`,`city`,`host`,`host_name`,`title`,`fee`,`base_fee`,`min_fee`,`max_fee`,`min_fee2`,`max_fee2`,`last_fee_change`,`seats`,`retail_price`,`asking_price`,`details`,`delivery`,`delivery_time`,`timer`,`start_date`,`free_bids`,`seats_taken`,`show_on_homepage`,`vet_players`,`tournament`,`final_round`,`refresh`,`repost`,`started`,`completed`,`active`,`create_date`,`complete_date`,`minimum_auctions`,`video`,`video2`,`show_pinterest`,`bid_fee`,`saves`,`seat_free`) SELECT `category`,`type`,`city`,`host`,

Categories : PHP

Add duplicate tab
If you need to duplicate the TabPage, the easiest path is to create a UserControl and just dock fill it into a new TabPage: TabPage tabPage = new TabPage() { Text = "New Tab" }; tabPage.Controls.Add(new MyUserControl() { Dock = DockStyle.Fill }); tabControl1.TabPages.Add(tabPage);

Categories : Dotnet



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.